Commit 5f23dae0 authored by Laurent Vivier's avatar Laurent Vivier Committed by Greg Kroah-Hartman
Browse files

hwrng: virtio - add an internal buffer



[ Upstream commit bf3175bc ]

hwrng core uses two buffers that can be mixed in the
virtio-rng queue.

If the buffer is provided with wait=0 it is enqueued in the
virtio-rng queue but unused by the caller.
On the next call, core provides another buffer but the
first one is filled instead and the new one queued.
And the caller reads the data from the new one that is not
updated, and the data in the first one are lost.

To avoid this mix, virtio-rng needs to use its own unique
internal buffer at a cost of a data copy to the caller buffer.

Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
Link: https://lore.kernel.org/r/20211028101111.128049-2-lvivier@redhat.com


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Stable-dep-of: ac52578d ("hwrng: virtio - Fix race on data_avail and actual data")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent aba192bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment