gazelle/0040-fix-sock-invalid-address.patch
jiangheng14 46ab1e1590 backport upstream patches:
update README
    fix some bugs
    refactor pkt read send to improve performance
    refactor kernle event toimproveperformance

(cherry picked from commit a8c66704608ca83c799adab88be6214bccdcfa44)
2022-07-07 22:46:16 +08:00

36 lines
1012 B
Diff

From 912ac954d0f462418bb09d2ad91e7092d5ad37be Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Tue, 19 Apr 2022 19:10:10 +0800
Subject: [PATCH 01/18] fix sock invalid address
sockets pointer is allocated memory in gazelle_network_init().
if invoke select_path before sockets pointer be initialized, sock is invalid
---
src/lstack/api/lstack_wrap.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 6ee5639..0164069 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -52,10 +52,15 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd)
}
return PATH_KERNEL;
}
+
+ if (unlikely(posix_api->is_chld)) {
+ return PATH_KERNEL;
+ }
+
struct lwip_sock *sock = posix_api->get_socket(fd);
/* AF_UNIX case */
- if (!sock || unlikely(posix_api->is_chld)) {
+ if (!sock) {
return PATH_KERNEL;
}
--
2.23.0