> vi->data_avail is decremented on each read, so it holds the remaining
> bytes rather than the total length. Subtracting vi->data_idx from it
> again in commit e3046eeada29 ("hwrng: virtio: clamp device-reported
> used.len at copy_data()") undercounts the bytes left after a partial
> read. This can leave vi->data_avail nonzero without queuing a new
> request, causing virtio_read() to hang on have_data.
> 
> Clamp vi->data_avail to sizeof(vi->data) - vi->data_idx instead.
> 
> Fixes: e3046eeada29 ("hwrng: virtio: clamp device-reported used.len at 
> copy_data()")
> Tested-by: Wei Liu <[email protected]>
> Cc: [email protected]
> Signed-off-by: Xiang Lei <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to