diff options
author | Jason Wang <[email protected]> | 2022-06-08 14:14:22 +0800 |
---|---|---|
committer | Michael S. Tsirkin <[email protected]> | 2022-06-08 08:56:03 -0400 |
commit | 228432551bd8783211e494ab35f42a4344580502 (patch) | |
tree | f403756902a5549b9838d4e7b0e57c428b630ab0 | |
parent | f2906aa863381afb0015a9eb7fefad885d4e5a56 (diff) |
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
8b4ec69d7e09 ("virtio: harden vring IRQ").
Fixing this by making device ready before the request.
Cc: [email protected]
Fixes: 8b4ec69d7e09 ("virtio: harden vring IRQ")
Fixes: f7f510ec1957 ("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]>
-rw-r--r-- | drivers/char/hw_random/virtio-rng.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |