Skip to content

Commit 2284325

Browse files
jasowangmstsirkin
authored andcommitted
virtio-rng: make device ready before making request
Current virtio-rng does a entropy request before DRIVER_OK, this violates the spec: virtio spec requires that all drivers set DRIVER_OK before using devices. Further, kernel will ignore the interrupt after commit 8b4ec69 ("virtio: harden vring IRQ"). Fixing this by making device ready before the request. Cc: [email protected] Fixes: 8b4ec69 ("virtio: harden vring IRQ") Fixes: f7f510e ("virtio: An entropy device, as suggested by hpa.") Reported-and-tested-by: [email protected] Signed-off-by: Jason Wang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Laurent Vivier <[email protected]>
1 parent f2906aa commit 2284325

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/char/hw_random/virtio-rng.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ static int probe_common(struct virtio_device *vdev)
159159
goto err_find;
160160
}
161161

162+
virtio_device_ready(vdev);
163+
162164
/* we always have a pending entropy request */
163165
request_entropy(vi);
164166

0 commit comments

Comments
 (0)