From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ao27H-0006PX-SW for qemu-devel@nongnu.org; Thu, 07 Apr 2016 01:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ao27F-0007dM-MK for qemu-devel@nongnu.org; Thu, 07 Apr 2016 01:04:27 -0400 Received: from nm8-vm2.bullet.mail.ne1.yahoo.com ([98.138.90.156]:46938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ao27F-0007ct-Ff for qemu-devel@nongnu.org; Thu, 07 Apr 2016 01:04:25 -0400 Date: Wed, 6 Apr 2016 22:04:21 -0700 From: Steven Luo Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH v2 1/4] slirp: don't crash when tcp_sockclosed() is called with a NULL tp List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Jan Kiszka , Samuel Thibault From: Steven Luo Signed-off-by: Steven Luo Reviewed-by: Edgar E. Iglesias --- v1->v2: * added Reviewed-by line slirp/tcp_subr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index dbfd2c6..32ff452 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -356,6 +356,10 @@ tcp_sockclosed(struct tcpcb *tp) DEBUG_CALL("tcp_sockclosed"); DEBUG_ARG("tp = %p", tp); + if (!tp) { + return; + } + switch (tp->t_state) { case TCPS_CLOSED: @@ -374,8 +378,7 @@ tcp_sockclosed(struct tcpcb *tp) tp->t_state = TCPS_LAST_ACK; break; } - if (tp) - tcp_output(tp); + tcp_output(tp); } /* -- 2.1.4