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: stable@vger.kernel.org Fixes: 8b4ec69 ("virtio: harden vring IRQ") Fixes: f7f510e ("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>
1 parent f2906aa commit 2284325

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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)