Re: [PATCH] vhost-scsi: fix page reference leak in misaligned I/O fallback
From: Jia Jia
Date: Thu Oct 22 2026 - 06:25:23 EST
>
> On 10/21/26 3:54 AM, Jia Jia wrote:
> > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> > index 4f8c0260bc9e..b7e41c0a91d4 100644
> > --- a/drivers/vhost/scsi.c
> > +++ b/drivers/vhost/scsi.c
> > @@ -883,11 +883,16 @@ vhost_scsi_map_to_sgl(struct vhost_scsi_cmd *cmd,
> > vhost_scsi_revert_map_iov_to_sgl(iter, *sgl, sg);
> >
> > iov_iter_revert(iter, bytes);
> > + /*
> > + * pages[npages] is the first page not added to the SG list. The
>
> Just a minor nit. There's an extra space before "The" in the comment.
>
Thanks for pointing this out. I'll remove it and send a v2.
> Patch looks ok otherwise. Thanks.
>
> Reviewed-by: Mike Christie <michael.christie@xxxxxxxxxx>
>
>
> > + * remaining data starts at offset in that page.
> > + */
> > while (bytes) {
> > - n = min_t(unsigned int, PAGE_SIZE, bytes);
> > + n = min_t(unsigned int, PAGE_SIZE - offset, bytes);
> >
> > put_page(pages[npages++]);
> > bytes -= n;
> > + offset = 0;
> > }
> >
> > return -EINVAL;
> > --
> > 2.47.0
> >
>