All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vhost: fix invalid downcast
@ 2018-07-13 14:04 Yury Kotov
  2018-07-13 16:15 ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Yury Kotov @ 2018-07-13 14:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, wrfsh

virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
If returned hwaddr is not equal to 0 but least-significant 32 bits are
equal to 0 then this code will not actually stop running queue.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
---
 hw/virtio/vhost.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index b129cb9..7edeee7 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1071,10 +1071,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
         .index = vhost_vq_index,
     };
     int r;
-    int a;
 
-    a = virtio_queue_get_desc_addr(vdev, idx);
-    if (a == 0) {
+    if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
         /* Don't stop the virtqueue which might have not been started */
         return;
     }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix invalid downcast
  2018-07-13 14:04 [Qemu-devel] [PATCH] vhost: fix invalid downcast Yury Kotov
@ 2018-07-13 16:15 ` Michael S. Tsirkin
  2018-07-14  4:09   ` Jia He
  2018-07-16  9:58   ` Юрий Котов
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2018-07-13 16:15 UTC (permalink / raw)
  To: Yury Kotov; +Cc: qemu-devel, wrfsh, Jia He

On Fri, Jul 13, 2018 at 05:04:05PM +0300, Yury Kotov wrote:
> virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
> If returned hwaddr is not equal to 0 but least-significant 32 bits are
> equal to 0 then this code will not actually stop running queue.
> 
> Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>

So IIUC

Fixes: fb20fbb764aa1 ("vhost: avoid to start/stop virtqueue which is not ready")
And 
Cc: qemu-stable@nongnu.org

> ---
>  hw/virtio/vhost.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index b129cb9..7edeee7 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1071,10 +1071,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
>          .index = vhost_vq_index,
>      };
>      int r;
> -    int a;
>  
> -    a = virtio_queue_get_desc_addr(vdev, idx);
> -    if (a == 0) {
> +    if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
>          /* Don't stop the virtqueue which might have not been started */
>          return;
>      }
> -- 
> 2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix invalid downcast
  2018-07-13 16:15 ` Michael S. Tsirkin
@ 2018-07-14  4:09   ` Jia He
  2018-07-16  9:58   ` Юрий Котов
  1 sibling, 0 replies; 4+ messages in thread
From: Jia He @ 2018-07-14  4:09 UTC (permalink / raw)
  To: Michael S. Tsirkin, Yury Kotov; +Cc: qemu-devel, wrfsh



On 7/14/2018 12:15 AM, Michael S. Tsirkin Wrote:
> On Fri, Jul 13, 2018 at 05:04:05PM +0300, Yury Kotov wrote:
>> virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
>> If returned hwaddr is not equal to 0 but least-significant 32 bits are
>> equal to 0 then this code will not actually stop running queue.
>>
>> Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
> 
> So IIUC
> 
> Fixes: fb20fbb764aa1 ("vhost: avoid to start/stop virtqueue which is not ready")

> And 
> Cc: qemu-stable@nongnu.org
> 
>> ---
>>  hw/virtio/vhost.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>> index b129cb9..7edeee7 100644
>> --- a/hw/virtio/vhost.c
>> +++ b/hw/virtio/vhost.c
>> @@ -1071,10 +1071,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
>>          .index = vhost_vq_index,
>>      };
>>      int r;
>> -    int a;
>>  
>> -    a = virtio_queue_get_desc_addr(vdev, idx);
>> -    if (a == 0) {
>> +    if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
>>          /* Don't stop the virtqueue which might have not been started */
>>          return;
>>      }
>> -- 
>> 2.7.4
> 
yes, it is a bug introduced by fb20fbb764aa1
Acked-by: Jia He <hejianet@gmail.com>
-- 
Cheers,
Jia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix invalid downcast
  2018-07-13 16:15 ` Michael S. Tsirkin
  2018-07-14  4:09   ` Jia He
@ 2018-07-16  9:58   ` Юрий Котов
  1 sibling, 0 replies; 4+ messages in thread
From: Юрий Котов @ 2018-07-16  9:58 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel@nongnu.org, wrfsh@yandex-team.ru, Jia He, qemu-stable

+ qemu-stable@

13.07.2018, 19:16, "Michael S. Tsirkin" <mst@redhat.com>:
> On Fri, Jul 13, 2018 at 05:04:05PM +0300, Yury Kotov wrote:
>>  virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
>>  If returned hwaddr is not equal to 0 but least-significant 32 bits are
>>  equal to 0 then this code will not actually stop running queue.
>>
>>  Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
>
> So IIUC
>
> Fixes: fb20fbb764aa1 ("vhost: avoid to start/stop virtqueue which is not ready")
> And
> Cc: qemu-stable@nongnu.org
>

Ok, done. Or did you mean I have to resend the patch-message to qemu-stable?

>>  ---
>>   hw/virtio/vhost.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>>  diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>>  index b129cb9..7edeee7 100644
>>  --- a/hw/virtio/vhost.c
>>  +++ b/hw/virtio/vhost.c
>>  @@ -1071,10 +1071,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
>>           .index = vhost_vq_index,
>>       };
>>       int r;
>>  - int a;
>>
>>  - a = virtio_queue_get_desc_addr(vdev, idx);
>>  - if (a == 0) {
>>  + if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
>>           /* Don't stop the virtqueue which might have not been started */
>>           return;
>>       }
>>  --
>>  2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-16  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 14:04 [Qemu-devel] [PATCH] vhost: fix invalid downcast Yury Kotov
2018-07-13 16:15 ` Michael S. Tsirkin
2018-07-14  4:09   ` Jia He
2018-07-16  9:58   ` Юрий Котов

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.