Skip to contentSkip to conversation

virtio-rng: make device ready before making request

PATCH In review Jason Wang 2 participants 2 messages Jun 8, 2022

Subsystems (3)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 virtio-rng: make device ready before making request

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 [email protected]
---
 drivers/char/hw_random/virtio-rng.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/char/hw_random/virtio-rng.c +2 -0
index e856df7e285c..a6f3a8a2aca6 100644
@@ -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);
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Jason Wang

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 [email protected]
---
  drivers/char/hw_random/virtio-rng.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/char/hw_random/virtio-rng.c +0 -0
index e856df7e285c..a6f3a8a2aca6 100644

drivers/char/hw_random/virtio-rng.c static int probe_common(struct virtio_device *vdev) · line 166

Quoted 8 lines
drivers/char/hw_random/virtio-rng.c +2 -0
@@ -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);