Skip to content

Commit e07fec4

Browse files
dhavalegregkh
authored andcommitted
usb: gadgetfs: Fix ep_read_iter to handle ITER_UBUF
iov_iter for ep_read_iter can be ITER_UBUF with io_uring. In that case dup_iter() does not have to allocate iov and it can return NULL. Fix the assumption by checking for iter_is_ubuf() other wise ep_read_iter can treat this as failure and return -ENOMEM. Fixes: 1e23db4 ("io_uring: use iter_ubuf for single range imports") Signed-off-by: Sandeep Dhavale <[email protected]> Acked-by: Jens Axboe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d356b3c commit e07fec4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/gadget/legacy/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)
614614
if (!priv)
615615
goto fail;
616616
priv->to_free = dup_iter(&priv->to, to, GFP_KERNEL);
617-
if (!priv->to_free) {
617+
if (!iter_is_ubuf(&priv->to) && !priv->to_free) {
618618
kfree(priv);
619619
goto fail;
620620
}

0 commit comments

Comments
 (0)