* [Qemu-devel] [PATCH] virtio-net: only delete bh that existed
@ 2013-11-06 8:58 Jason Wang
2013-11-06 10:09 ` [Qemu-devel] [PATCH 1.7] " Paolo Bonzini
2013-11-06 11:17 ` [Qemu-devel] [PATCH] " Michael S. Tsirkin
0 siblings, 2 replies; 4+ messages in thread
From: Jason Wang @ 2013-11-06 8:58 UTC (permalink / raw)
To: aliguori, qemu-devel, mst; +Cc: Jason Wang, qemu-stable
We delete without check whether it existed during exit. This will lead NULL
pointer deference since it was created conditionally depends on guest driver
status and features. So add a check of existence before trying to delete it.
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/virtio-net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 22dbd05..ae51d96 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
if (q->tx_timer) {
timer_del(q->tx_timer);
timer_free(q->tx_timer);
- } else {
+ } else if (q->tx_bh) {
qemu_bh_delete(q->tx_bh);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1.7] virtio-net: only delete bh that existed
2013-11-06 8:58 [Qemu-devel] [PATCH] virtio-net: only delete bh that existed Jason Wang
@ 2013-11-06 10:09 ` Paolo Bonzini
2013-11-06 11:17 ` [Qemu-devel] [PATCH] " Michael S. Tsirkin
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-11-06 10:09 UTC (permalink / raw)
To: Jason Wang; +Cc: qemu-stable, qemu-devel, aliguori, mst
Il 06/11/2013 09:58, Jason Wang ha scritto:
> We delete without check whether it existed during exit. This will lead NULL
> pointer deference since it was created conditionally depends on guest driver
> status and features. So add a check of existence before trying to delete it.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> hw/net/virtio-net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 22dbd05..ae51d96 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
> if (q->tx_timer) {
> timer_del(q->tx_timer);
> timer_free(q->tx_timer);
> - } else {
> + } else if (q->tx_bh) {
> qemu_bh_delete(q->tx_bh);
> }
> }
>
Please remember to add 1.7 in the subject at this time.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-net: only delete bh that existed
2013-11-06 8:58 [Qemu-devel] [PATCH] virtio-net: only delete bh that existed Jason Wang
2013-11-06 10:09 ` [Qemu-devel] [PATCH 1.7] " Paolo Bonzini
@ 2013-11-06 11:17 ` Michael S. Tsirkin
2013-11-07 3:03 ` Jason Wang
1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2013-11-06 11:17 UTC (permalink / raw)
To: Jason Wang; +Cc: qemu-devel, aliguori, qemu-stable
On Wed, Nov 06, 2013 at 04:58:08PM +0800, Jason Wang wrote:
> We delete without check whether it existed during exit. This will lead NULL
> pointer deference since it was created conditionally depends on guest driver
> status and features. So add a check of existence before trying to delete it.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Looks like the bug was introduced by:
commit 17ec5a8686143da66208273d355f2eeb09807614
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date: Thu Apr 11 16:29:57 2013 +0200
virtio-net: add the virtio-net device.
Before that we had a single bh and created/destroyed
that unconditionally.
Is this a correct analysis?
> ---
> hw/net/virtio-net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 22dbd05..ae51d96 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
> if (q->tx_timer) {
> timer_del(q->tx_timer);
> timer_free(q->tx_timer);
> - } else {
> + } else if (q->tx_bh) {
> qemu_bh_delete(q->tx_bh);
> }
> }
> --
> 1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-net: only delete bh that existed
2013-11-06 11:17 ` [Qemu-devel] [PATCH] " Michael S. Tsirkin
@ 2013-11-07 3:03 ` Jason Wang
0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2013-11-07 3:03 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel, aliguori, qemu-stable
On 11/06/2013 07:17 PM, Michael S. Tsirkin wrote:
> On Wed, Nov 06, 2013 at 04:58:08PM +0800, Jason Wang wrote:
>> We delete without check whether it existed during exit. This will lead NULL
>> pointer deference since it was created conditionally depends on guest driver
>> status and features. So add a check of existence before trying to delete it.
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>
> Looks like the bug was introduced by:
> commit 17ec5a8686143da66208273d355f2eeb09807614
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date: Thu Apr 11 16:29:57 2013 +0200
> virtio-net: add the virtio-net device.
>
> Before that we had a single bh and created/destroyed
> that unconditionally.
> Is this a correct analysis?
>
Nope, it was introduced in the multiqueue virito-net, since the bh were
created conditionally from that commit.
commit fed699f9ca6ae8a0fb62803334cf46fa64d1eb91
Author: Jason Wang <jasowang@redhat.com>
Date: Wed Jan 30 19:12:39 2013 +0800
virtio-net: multiqueue support
>
>> ---
>> hw/net/virtio-net.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 22dbd05..ae51d96 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
>> if (q->tx_timer) {
>> timer_del(q->tx_timer);
>> timer_free(q->tx_timer);
>> - } else {
>> + } else if (q->tx_bh) {
>> qemu_bh_delete(q->tx_bh);
>> }
>> }
>> --
>> 1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-07 3:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 8:58 [Qemu-devel] [PATCH] virtio-net: only delete bh that existed Jason Wang
2013-11-06 10:09 ` [Qemu-devel] [PATCH 1.7] " Paolo Bonzini
2013-11-06 11:17 ` [Qemu-devel] [PATCH] " Michael S. Tsirkin
2013-11-07 3:03 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).