linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio-rng: make device ready before making request
@ 2022-06-08  6:14 Jason Wang
  2022-06-08 12:17 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2022-06-08  6:14 UTC (permalink / raw)
  To: mst, mpm, herbert
  Cc: linux-crypto, linux-kernel, lvivier, Jason Wang,
	syzbot+5b59d6d459306a556f54

Current virtio-rng does a entropy request before DRIVER_OK, this
violates the spec and kernel will ignore the interrupt after commit
8b4ec69d7e09 ("virtio: harden vring IRQ").

Fixing this by making device ready before the request.

Fixes: 8b4ec69d7e09 ("virtio: harden vring IRQ")
Reported-and-tested-by: syzbot+5b59d6d459306a556f54@syzkaller.appspotmail.com
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/char/hw_random/virtio-rng.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index e856df7e285c..a6f3a8a2aca6 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -159,6 +159,8 @@ static int probe_common(struct virtio_device *vdev)
 		goto err_find;
 	}
 
+	virtio_device_ready(vdev);
+
 	/* we always have a pending entropy request */
 	request_entropy(vi);
 
-- 
2.25.1


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

* Re: [PATCH] virtio-rng: make device ready before making request
  2022-06-08  6:14 [PATCH] virtio-rng: make device ready before making request Jason Wang
@ 2022-06-08 12:17 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2022-06-08 12:17 UTC (permalink / raw)
  To: Jason Wang, mst, mpm, herbert
  Cc: linux-crypto, linux-kernel, syzbot+5b59d6d459306a556f54

On 08/06/2022 08:14, Jason Wang wrote:
> Current virtio-rng does a entropy request before DRIVER_OK, this
> violates the spec and kernel will ignore the interrupt after commit
> 8b4ec69d7e09 ("virtio: harden vring IRQ").
> 
> Fixing this by making device ready before the request.
> 
> Fixes: 8b4ec69d7e09 ("virtio: harden vring IRQ")
> Reported-and-tested-by: syzbot+5b59d6d459306a556f54@syzkaller.appspotmail.com
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>   drivers/char/hw_random/virtio-rng.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
> index e856df7e285c..a6f3a8a2aca6 100644
> --- a/drivers/char/hw_random/virtio-rng.c
> +++ b/drivers/char/hw_random/virtio-rng.c
> @@ -159,6 +159,8 @@ static int probe_common(struct virtio_device *vdev)
>   		goto err_find;
>   	}
>   
> +	virtio_device_ready(vdev);
> +
>   	/* we always have a pending entropy request */
>   	request_entropy(vi);
>   

Reviewed-by: Laurent Vivier <lvivier@redhat.com>


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

end of thread, other threads:[~2022-06-08 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08  6:14 [PATCH] virtio-rng: make device ready before making request Jason Wang
2022-06-08 12:17 ` Laurent Vivier

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).