* [Qemu-devel] [PATCH] vhost: check for vhost_ops before using.
@ 2016-08-03 5:22 Ilya Maximets
2016-08-03 8:37 ` Marc-André Lureau
0 siblings, 1 reply; 3+ messages in thread
From: Ilya Maximets @ 2016-08-03 5:22 UTC (permalink / raw)
To: qemu-devel, Michael S . Tsirkin
Cc: Dyasly Sergey, Marc-Andre Lureau, Heetae Ahn, Ilya Maximets
'vhost_set_vring_enable()' tries to call function using pointer to
'vhost_ops' which can be already zeroized in 'vhost_dev_cleanup()'
while vhost disconnection.
Fix that by checking 'vhost_ops' before using. This fixes QEMU crash
on calling 'ethtool -L eth0 combined 2' if vhost disconnected.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
hw/net/vhost_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index dc61dc1..f2d49ad 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -428,7 +428,7 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
nc->vring_enable = enable;
- if (vhost_ops->vhost_set_vring_enable) {
+ if (vhost_ops && vhost_ops->vhost_set_vring_enable) {
return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost: check for vhost_ops before using.
2016-08-03 5:22 [Qemu-devel] [PATCH] vhost: check for vhost_ops before using Ilya Maximets
@ 2016-08-03 8:37 ` Marc-André Lureau
2016-08-09 10:27 ` Marc-André Lureau
0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2016-08-03 8:37 UTC (permalink / raw)
To: Ilya Maximets, qemu-devel, Michael S . Tsirkin; +Cc: Heetae Ahn, Dyasly Sergey
Hi
On Wed, Aug 3, 2016 at 9:25 AM Ilya Maximets <i.maximets@samsung.com> wrote:
> 'vhost_set_vring_enable()' tries to call function using pointer to
> 'vhost_ops' which can be already zeroized in 'vhost_dev_cleanup()'
> while vhost disconnection.
>
> Fix that by checking 'vhost_ops' before using. This fixes QEMU crash
> on calling 'ethtool -L eth0 combined 2' if vhost disconnected.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
> hw/net/vhost_net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index dc61dc1..f2d49ad 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -428,7 +428,7 @@ int vhost_set_vring_enable(NetClientState *nc, int
> enable)
>
> nc->vring_enable = enable;
>
> - if (vhost_ops->vhost_set_vring_enable) {
> + if (vhost_ops && vhost_ops->vhost_set_vring_enable) {
> return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
> }
>
would be nice for 2.7,
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> --
> 2.7.4
>
>
> --
Marc-André Lureau
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost: check for vhost_ops before using.
2016-08-03 8:37 ` Marc-André Lureau
@ 2016-08-09 10:27 ` Marc-André Lureau
0 siblings, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2016-08-09 10:27 UTC (permalink / raw)
To: Ilya Maximets, qemu-devel, Michael S . Tsirkin; +Cc: Heetae Ahn, Dyasly Sergey
Hi
On Wed, Aug 3, 2016 at 12:37 PM Marc-André Lureau <
marcandre.lureau@gmail.com> wrote:
> Hi
>
> On Wed, Aug 3, 2016 at 9:25 AM Ilya Maximets <i.maximets@samsung.com>
> wrote:
>
>> 'vhost_set_vring_enable()' tries to call function using pointer to
>> 'vhost_ops' which can be already zeroized in 'vhost_dev_cleanup()'
>> while vhost disconnection.
>>
>> Fix that by checking 'vhost_ops' before using. This fixes QEMU crash
>> on calling 'ethtool -L eth0 combined 2' if vhost disconnected.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>> ---
>> hw/net/vhost_net.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>> index dc61dc1..f2d49ad 100644
>> --- a/hw/net/vhost_net.c
>> +++ b/hw/net/vhost_net.c
>> @@ -428,7 +428,7 @@ int vhost_set_vring_enable(NetClientState *nc, int
>> enable)
>>
>> nc->vring_enable = enable;
>>
>> - if (vhost_ops->vhost_set_vring_enable) {
>> + if (vhost_ops && vhost_ops->vhost_set_vring_enable) {
>> return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
>> }
>>
>
> would be nice for 2.7,
>
Michael, could you pick the fix for 2.7? thanks
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
>>
>> --
>> 2.7.4
>>
>>
>> --
> Marc-André Lureau
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-09 10:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 5:22 [Qemu-devel] [PATCH] vhost: check for vhost_ops before using Ilya Maximets
2016-08-03 8:37 ` Marc-André Lureau
2016-08-09 10:27 ` Marc-André Lureau
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).