From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: Yunjian Wang <wangyunjian@huawei.com>,
qemu-stable@nongnu.org, Jason Wang <jasowang@redhat.com>
Subject: [Qemu-devel] [PULL 3/9] virtio-net: fix wild pointer when remove virtio-net queues
Date: Tue, 23 May 2017 10:43:53 +0800 [thread overview]
Message-ID: <1495507439-1784-4-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1495507439-1784-1-git-send-email-jasowang@redhat.com>
From: Yunjian Wang <wangyunjian@huawei.com>
The tx_bh or tx_timer will free in virtio_net_del_queue() function, when
removing virtio-net queues if the guest doesn't support multiqueue. But
it might be still referenced by virtio_net_set_status(), which needs to
be set NULL. And also the tx_waiting needs to be set zero to prevent
virtio_net_set_status() accessing tx_bh or tx_timer.
Cc: qemu-stable@nongnu.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/virtio-net.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 7d091c9..98bd683 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1522,9 +1522,12 @@ static void virtio_net_del_queue(VirtIONet *n, int index)
if (q->tx_timer) {
timer_del(q->tx_timer);
timer_free(q->tx_timer);
+ q->tx_timer = NULL;
} else {
qemu_bh_delete(q->tx_bh);
+ q->tx_bh = NULL;
}
+ q->tx_waiting = 0;
virtio_del_queue(vdev, index * 2 + 1);
}
--
2.7.4
next prev parent reply other threads:[~2017-05-23 2:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 2:43 [Qemu-devel] [PULL 0/9] Net patches Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 1/9] net/tap: Replace tap-haiku.c and tap-aix.c by a generic tap-stub.c Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 2/9] net/dump: Issue a warning for the deprecated "-net dump" Jason Wang
2017-05-23 2:43 ` Jason Wang [this message]
2017-05-23 2:43 ` [Qemu-devel] [PULL 4/9] COLO-compare: Improve tcp compare trace event readability Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 5/9] hmp / net: Mark host_net_add/remove as deprecated Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 6/9] net/filter-mirror.c: Remove duplicate check code Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 7/9] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 8/9] net/filter-rewriter: Remove unused option in filter-rewriter Jason Wang
2017-05-23 2:43 ` [Qemu-devel] [PULL 9/9] e1000e: Fix ICR "Other" causes clear logic Jason Wang
2017-05-23 13:54 ` [Qemu-devel] [PULL 0/9] Net patches Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495507439-1784-4-git-send-email-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=wangyunjian@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.