mod lwip null pointer

(cherry picked from commit 26c2cbc20e5edbb4c6350e10a93e4a33c23bed20)
This commit is contained in:
hantwofish 2023-12-14 14:58:06 +08:00 committed by openeuler-sync-bot
parent 0bb5878b84
commit 48b823c998
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From dcdd7d73c6083a63fe966a68f11eddcafa3fd743 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Thu, 14 Dec 2023 14:51:37 +0800
Subject: [PATCH] resove null pointer
---
src/api/sockets.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index a9d39ae..0b3e4ea 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -801,15 +801,17 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
#endif /* GAZELLE_ENABLE */
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
#if GAZELLE_ENABLE
+ int ret = 0;
struct tcp_pcb *pcb = newconn->pcb.tcp;
- if (pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
- if (find_same_node_memzone(pcb, nsock) != 0) {
+ if (pcb != NULL && pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
+ ret = find_same_node_memzone(pcb, nsock);
+ }
+ if (pcb == NULL || ret != 0) {
netconn_delete(newconn);
free_socket(nsock, 1);
sock_set_errno(sock, ENOTCONN);
done_socket(sock);
return -1;
- }
}
#endif
--
2.33.0

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 95
Release: 96
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -106,6 +106,7 @@ Patch9088: 0089-add-struct-gz-addr.patch
Patch9089: 0090-frag-fix-coredump-when-get-netif.patch
Patch9090: 0091-add-fd-log-info-and-fix-wrong-port-log-info.patch
Patch9091: 0092-fix-the-coredump-issue-when-UDP-traffic-is-sent.patch
Patch9092: 0093-modfiy-accept-null-pointer-when-new-conn-receive-RST-packet-in-listening.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -136,6 +137,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Thu Dec 14 2023 hankangkang <hankangkang5@huawei.com> - 2.1.3-96
- modfiy-accept-null-pointer-when-new-conn-receive-RST-packet-in-listening
* Sat Dec 9 2023 wuchangye <wuchangye@huawei.com> - 2.1.3-95
- fix the coredump issue when UDP traffic is sent