On Thu, Aug 06, 2026 at 02:51:43PM +0800, Jia Jia wrote:
> vhost_scsi_complete_cmd_work() drops the virtqueue mutex before calling
> vhost_signal(). VHOST_SET_VRING_CALL replaces call_ctx.ctx and releases the
> old eventfd_ctx while holding the same mutex. vhost_signal() reads the call
> context before and after vhost_notify(), so a concurrent callfd update can
> make it signal a freed context or NULL.
> 
> KASAN reported the use through:
> 
>       eventfd_signal_mask
>       vhost_signal
>       vhost_scsi_complete_cmd_work
> 
> The context was released through:
> 
>       eventfd_ctx_put
>       vhost_vring_ioctl
>       vhost_scsi_ioctl
> 
> Keep the mutex held through vhost_signal() so completion notification and
> callfd updates are serialized.
> 
> Fixes: 057cbf49a1f0 ("tcm_vhost: Initial merge for vhost level target fabric 
> driver")
> Link: 
> https://lore.kernel.org/r/[email protected]
> Signed-off-by: Jia Jia <[email protected]>
> ---
> Changes since RFC:
> - Send as a non-RFC v2.
> - Add Fixes and Link tags.
> 
>  drivers/vhost/scsi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <[email protected]>

Attachment: signature.asc
Description: PGP signature

Reply via email to