[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 01/12] slirp: fix clearing ifq_so from pending pack
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 01/12] slirp: fix clearing ifq_so from pending packets |
Date: |
Tue, 19 Sep 2017 19:45:10 -0500 |
From: Samuel Thibault <address@hidden>
The if_fastq and if_batchq contain not only packets, but queues of packets
for the same socket. When sofree frees a socket, it thus has to clear ifq_so
from all the packets from the queues, not only the first.
Signed-off-by: Samuel Thibault <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Cc: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
(cherry picked from commit 1201d308519f1e915866d7583d5136d03cc1d384)
Signed-off-by: Michael Roth <address@hidden>
---
slirp/socket.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/slirp/socket.c b/slirp/socket.c
index ecec0295a9..cb7b5b608d 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -60,29 +60,36 @@ socreate(Slirp *slirp)
}
/*
+ * Remove references to so from the given message queue.
+ */
+static void
+soqfree(struct socket *so, struct quehead *qh)
+{
+ struct mbuf *ifq;
+
+ for (ifq = (struct mbuf *) qh->qh_link;
+ (struct quehead *) ifq != qh;
+ ifq = ifq->ifq_next) {
+ if (ifq->ifq_so == so) {
+ struct mbuf *ifm;
+ ifq->ifq_so = NULL;
+ for (ifm = ifq->ifs_next; ifm != ifq; ifm = ifm->ifs_next) {
+ ifm->ifq_so = NULL;
+ }
+ }
+ }
+}
+
+/*
* remque and free a socket, clobber cache
*/
void
sofree(struct socket *so)
{
Slirp *slirp = so->slirp;
- struct mbuf *ifm;
- for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;
- (struct quehead *) ifm != &slirp->if_fastq;
- ifm = ifm->ifq_next) {
- if (ifm->ifq_so == so) {
- ifm->ifq_so = NULL;
- }
- }
-
- for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;
- (struct quehead *) ifm != &slirp->if_batchq;
- ifm = ifm->ifq_next) {
- if (ifm->ifq_so == so) {
- ifm->ifq_so = NULL;
- }
- }
+ soqfree(so, &slirp->if_fastq);
+ soqfree(so, &slirp->if_batchq);
if (so->so_emu==EMU_RSH && so->extra) {
sofree(so->extra);
--
2.11.0
- [Qemu-stable] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 09/12] mps2-an511: Fix wiring of UART overflow interrupt lines, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 10/12] scsi-bus: correct responses for INQUIRY and REQUEST SENSE, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 03/12] target/arm: Fix aa64 ldp register writeback, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 11/12] libvhost-user: support resuming vq->last_avail_idx based on used_idx, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 02/12] s390-ccw: Fix alignment for CCW1, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 12/12] vhost-user-bridge: fix resume regression (since 2.9), Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 07/12] qcow2: move qcow2_store_persistent_dirty_bitmaps() before cache flushing, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 06/12] hw/arm/allwinner-a10: Mark the allwinner-a10 device with user_creatable = false, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 05/12] arm_gicv3_kvm: Fix compile warning, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 01/12] slirp: fix clearing ifq_so from pending packets,
Michael Roth <=
- [Qemu-stable] [PATCH 04/12] virtfs: error out gracefully when mandatory suboptions are missing, Michael Roth, 2017/09/19
- [Qemu-stable] [PATCH 08/12] vhost: Release memory references on cleanup, Michael Roth, 2017/09/19
- Re: [Qemu-stable] [Qemu-devel] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Thomas Huth, 2017/09/20
- Re: [Qemu-stable] [Qemu-devel] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Greg Kurz, 2017/09/20
- Re: [Qemu-stable] [Qemu-devel] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Michael Roth, 2017/09/25
- Re: [Qemu-stable] [Qemu-devel] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Anthony PERARD, 2017/09/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 00/12] Patch Round-up for stable 2.10.1, freeze on 2017-09-27, Eric Blake, 2017/09/26