> Two readers can use the same port at once. The read path checks for
> input under inbuf_lock, but fill_readbuf() copies to userspace after the
> lock is released. A second reader can take the same buffer, and the
> input callback can prefetch the next buffer while the first one is still
> in use. This can duplicate data or change its order.
> 
> The read path can also touch the input virtqueue after unplug_port() has
> started tearing it down.
> 
> Let one reader claim port->inbuf while it copies. The claim is published
> under inbuf_lock; other readers wait, and the input callback does not
> prefetch until the claim is released. If the reader does not consume the
> whole buffer, the remainder goes back to port->inbuf before another
> reader can use the next one.
> 
> [ ... ]
> returned -ENODEV, and removing one port left the other port usable.
> CONFIG_CONSOLE_POLL and real remoteproc DMA were not runtime-tested.
> 
> Fixes: 203baab8ba319 ("virtio: console: Introduce function to hand off data 
> from host to readers")
> Signed-off-by: Yaohan Li <[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