]> git.ipfire.org Git - thirdparty/linux.git/commit
usb: gadget: f_fs: Fix ioctl error handling
authorSam Day <me@samcday.com>
Wed, 7 Jan 2026 22:30:20 +0000 (08:30 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jan 2026 14:58:22 +0000 (15:58 +0100)
commit8e4c1d06183c25022f6b0002a5cab84979ca6337
tree65e60bb41ff41f6cee646671a22d8df3bfa47f68
parentda0faa257f10da39052ca7f1cfa35179ca8749e5
usb: gadget: f_fs: Fix ioctl error handling

When ffs_epfile_ioctl handles FUNCTIONFS_DMABUF_* ioctls, it's currently
falling through when copy_from_user fails.

However, this fallthrough isn't being checked properly, so the handler
continues executing further than it should. It then tries the secondary
dispatch where it ultimately gives up and returns -ENOTTY.

The end result is invalid ioctl invocations will yield a -ENOTTY rather
than an -EFAULT.

It's a common pattern elsewhere in the kernel code to directly return
-EFAULT when copy_from_user fails. So we update ffs_epfile_ioctl to do
the same and fix this issue.

Signed-off-by: Sam Day <me@samcday.com>
Link: https://patch.msgid.link/20260108-ffs-dmabuf-ioctl-fix-v1-1-e51633891a81@samcday.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c