|
|
9bac43 |
From fab160fce838f609b3a395fcef40e4efce5c0fa7 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Xiao Wang <jasowang@redhat.com>
|
|
|
9bac43 |
Date: Tue, 28 Nov 2017 03:43:20 +0100
|
|
|
9bac43 |
Subject: [PATCH 14/21] slirp: fix clearing ifq_so from pending packets
|
|
|
9bac43 |
MIME-Version: 1.0
|
|
|
9bac43 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9bac43 |
Content-Transfer-Encoding: 8bit
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Xiao Wang <jasowang@redhat.com>
|
|
|
9bac43 |
Message-id: <1511840600-52375-1-git-send-email-jasowang@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 77930
|
|
|
9bac43 |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH] slirp: fix clearing ifq_so from pending packets
|
|
|
9bac43 |
Bugzilla: 1508750
|
|
|
9bac43 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: wexu@redhat.com
|
|
|
9bac43 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
9bac43 |
|
|
|
9bac43 |
The if_fastq and if_batchq contain not only packets, but queues of packets
|
|
|
9bac43 |
for the same socket. When sofree frees a socket, it thus has to clear ifq_so
|
|
|
9bac43 |
from all the packets from the queues, not only the first.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
9bac43 |
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
|
|
|
9bac43 |
Cc: qemu-stable@nongnu.org
|
|
|
9bac43 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
9bac43 |
(cherry picked from commit 1201d308519f1e915866d7583d5136d03cc1d384)
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
slirp/socket.c | 39 +++++++++++++++++++++++----------------
|
|
|
9bac43 |
1 file changed, 23 insertions(+), 16 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/slirp/socket.c b/slirp/socket.c
|
|
|
9bac43 |
index ecec029..cb7b5b6 100644
|
|
|
9bac43 |
--- a/slirp/socket.c
|
|
|
9bac43 |
+++ b/slirp/socket.c
|
|
|
9bac43 |
@@ -60,29 +60,36 @@ socreate(Slirp *slirp)
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
/*
|
|
|
9bac43 |
+ * Remove references to so from the given message queue.
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+static void
|
|
|
9bac43 |
+soqfree(struct socket *so, struct quehead *qh)
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ struct mbuf *ifq;
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ for (ifq = (struct mbuf *) qh->qh_link;
|
|
|
9bac43 |
+ (struct quehead *) ifq != qh;
|
|
|
9bac43 |
+ ifq = ifq->ifq_next) {
|
|
|
9bac43 |
+ if (ifq->ifq_so == so) {
|
|
|
9bac43 |
+ struct mbuf *ifm;
|
|
|
9bac43 |
+ ifq->ifq_so = NULL;
|
|
|
9bac43 |
+ for (ifm = ifq->ifs_next; ifm != ifq; ifm = ifm->ifs_next) {
|
|
|
9bac43 |
+ ifm->ifq_so = NULL;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+/*
|
|
|
9bac43 |
* remque and free a socket, clobber cache
|
|
|
9bac43 |
*/
|
|
|
9bac43 |
void
|
|
|
9bac43 |
sofree(struct socket *so)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
Slirp *slirp = so->slirp;
|
|
|
9bac43 |
- struct mbuf *ifm;
|
|
|
9bac43 |
|
|
|
9bac43 |
- for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;
|
|
|
9bac43 |
- (struct quehead *) ifm != &slirp->if_fastq;
|
|
|
9bac43 |
- ifm = ifm->ifq_next) {
|
|
|
9bac43 |
- if (ifm->ifq_so == so) {
|
|
|
9bac43 |
- ifm->ifq_so = NULL;
|
|
|
9bac43 |
- }
|
|
|
9bac43 |
- }
|
|
|
9bac43 |
-
|
|
|
9bac43 |
- for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;
|
|
|
9bac43 |
- (struct quehead *) ifm != &slirp->if_batchq;
|
|
|
9bac43 |
- ifm = ifm->ifq_next) {
|
|
|
9bac43 |
- if (ifm->ifq_so == so) {
|
|
|
9bac43 |
- ifm->ifq_so = NULL;
|
|
|
9bac43 |
- }
|
|
|
9bac43 |
- }
|
|
|
9bac43 |
+ soqfree(so, &slirp->if_fastq);
|
|
|
9bac43 |
+ soqfree(so, &slirp->if_batchq);
|
|
|
9bac43 |
|
|
|
9bac43 |
if (so->so_emu==EMU_RSH && so->extra) {
|
|
|
9bac43 |
sofree(so->extra);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|