virtio: rng: Check length before copying
authorAndrew Scull <ascull@google.com>
Mon, 16 May 2022 10:41:39 +0000 (10:41 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 8 Jun 2022 13:24:04 +0000 (09:24 -0400)
commit43937a4f5e411b3a82014fe0fa78ef4de90b11c2
treeb5cdedd90ad28a3cc937bd335b5a9e93748b83df
parent420b3e51f4f64ebc6ab88f751f116e634894b231
virtio: rng: Check length before copying

Check the length of data written by the device is consistent with the
size of the buffers to avoid out-of-bounds memory accesses in case
values aren't consistent.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/virtio/virtio_rng.c