|
|
9ae3a8 |
From 8c490d636f5dbe289b43cd0c34413aca3e62e2a9 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Xiao Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 27 Nov 2017 07:07:56 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 5/9] slirp: Fix access to freed memory
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Xiao Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1511766477-29559-4-git-send-email-jasowang@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 77898
|
|
|
9ae3a8 |
O-Subject: [RHEL7.5 qemu-kvm PATCH 3/4] slirp: Fix access to freed memory
|
|
|
9ae3a8 |
Bugzilla: 1508745
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: wexu@redhat.com
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if_start() goes through the slirp->if_fastq and slirp->if_batchq
|
|
|
9ae3a8 |
list of pending messages, and accesses ifm->ifq_so->so_nqueued of its
|
|
|
9ae3a8 |
elements if ifm->ifq_so != NULL. When freeing a socket, we thus need
|
|
|
9ae3a8 |
to make sure that any pending message for this socket does not refer
|
|
|
9ae3a8 |
to the socket any more.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
9ae3a8 |
Tested-by: Brian Candler <b.candler@pobox.com>
|
|
|
9ae3a8 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit ea64d5f08817b5e79e17135dce516c7583107f91)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
slirp/socket.c | 17 +++++++++++++++++
|
|
|
9ae3a8 |
1 file changed, 17 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/slirp/socket.c b/slirp/socket.c
|
|
|
9ae3a8 |
index 8e8819c..09b5d3d 100644
|
|
|
9ae3a8 |
--- a/slirp/socket.c
|
|
|
9ae3a8 |
+++ b/slirp/socket.c
|
|
|
9ae3a8 |
@@ -63,6 +63,23 @@ void
|
|
|
9ae3a8 |
sofree(struct socket *so)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
Slirp *slirp = so->slirp;
|
|
|
9ae3a8 |
+ struct mbuf *ifm;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;
|
|
|
9ae3a8 |
+ (struct quehead *) ifm != &slirp->if_fastq;
|
|
|
9ae3a8 |
+ ifm = ifm->ifq_next) {
|
|
|
9ae3a8 |
+ if (ifm->ifq_so == so) {
|
|
|
9ae3a8 |
+ ifm->ifq_so = NULL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;
|
|
|
9ae3a8 |
+ (struct quehead *) ifm != &slirp->if_batchq;
|
|
|
9ae3a8 |
+ ifm = ifm->ifq_next) {
|
|
|
9ae3a8 |
+ if (ifm->ifq_so == so) {
|
|
|
9ae3a8 |
+ ifm->ifq_so = NULL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (so->so_emu==EMU_RSH && so->extra) {
|
|
|
9ae3a8 |
sofree(so->extra);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|