[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/3] slirp: don't crash when tcp_sockclosed() is cal
From: |
steven |
Subject: |
[Qemu-devel] [PATCH 1/3] slirp: don't crash when tcp_sockclosed() is called with a NULL tp |
Date: |
Tue, 5 Apr 2016 17:14:15 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Signed-off-by: Steven Luo <address@hidden>
---
This prevents a crash that would be exposed by a later patch in this
series. The removed check for non-null is clearly wrong, as it comes
after the pointer has already been dereferenced in this function.
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
- [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest, steven, 2016/04/05
- [Qemu-devel] [PATCH 1/3] slirp: don't crash when tcp_sockclosed() is called with a NULL tp,
steven <=
- [Qemu-devel] [PATCH 2/3] slirp: Propagate host TCP RST to the guest., steven, 2016/04/05
- [Qemu-devel] [PATCH 3/3] slirp: handle deferred ECONNREFUSED on non-blocking TCP sockets, steven, 2016/04/05
- Re: [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest, Thomas Huth, 2016/04/06
- Re: [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest, Edgar E. Iglesias, 2016/04/06
- Re: [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest, Samuel Thibault, 2016/04/06