]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
usb: gadget: f_fs: Initialize epfile->in early to fix endpoint direction checks
authorNeill Kapron <nkapron@google.com>
Fri, 19 Jun 2026 04:06:03 +0000 (04:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jun 2026 14:23:51 +0000 (15:23 +0100)
commit82cfd4739011bdc7e87b5d585703427e89ddfaa5
tree77b2f5117a95aacc55e9d5d0c7a1a3397c513867
parent1f0bdc2884b67de337215079bba166df0cdf4ac5
usb: gadget: f_fs: Initialize epfile->in early to fix endpoint direction checks

When parsing endpoint descriptors, ffs_data_got_descs() generates the
eps_addrmap which contains the endpoint direction. However, epfile->in
was previously only populated in ffs_func_eps_enable() which executes
upon USB host connection. As a result, early userspace ioctls like
FUNCTIONFS_DMABUF_ATTACH that run before the host connects would see
epfile->in as 0, leading to incorrect DMA directions.

By moving the initialization to ffs_epfiles_create(), epfile->in is
accurate before userspace opens the endpoint files.

Fixes: 7b07a2a7ca02 ("usb: gadget: functionfs: Add DMABUF import interface")
Cc: stable <stable@kernel.org>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Neill Kapron <nkapron@google.com>
Link: https://patch.msgid.link/20260619040609.4010746-2-nkapron@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c