diff options
author | Jason Wang <jasowang@redhat.com> | 2022-06-08 14:14:22 +0800 |
---|---|---|
committer | Carlos Llamas <cmllamas@google.com> | 2024-02-29 00:29:45 +0000 |
commit | 27d93dc9223fdc902ad43aca8139c7daa3288748 (patch) | |
tree | 1c99d87d78d03046f5157f90a0365a60e941875d | |
parent | 0ac651d0339771aae7effef56b1594281e153340 (diff) | |
download | hikey-linaro-27d93dc9223fdc902ad43aca8139c7daa3288748.tar.gz |
UPSTREAM: 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: stable@vger.kernel.org
Fixes: 8b4ec69d7e09 ("virtio: harden vring IRQ")
Fixes: f7f510ec1957 ("virtio: An entropy device, as suggested by hpa.")
Reported-and-tested-by: syzbot+5b59d6d459306a556f54@syzkaller.appspotmail.com
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220608061422.38437-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Bug: 324967354
(cherry picked from commit 228432551bd8783211e494ab35f42a4344580502)
Change-Id: I1886e8a1192c8f7ccf384f3705efa16a31bebcff
Reported-and-tested-by: Roman Kiryanov <rkir@google.com> (against android13-5.15)
Suggested-by: John Stultz <jstultz@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
-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 3a194eb3ce8a..9e86e7ff267b 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); |