]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: f_fs: Fix a race condition when processing setup packets.
authorChris Wulff <Chris.Wulff@biamp.com>
Tue, 23 Apr 2024 18:02:15 +0000 (18:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:59 +0000 (12:14 +0200)
commit3d117c7b5aaa9d230b7e94bc2bc1a9d33d432a1a
tree2f5cb2d66ab2fc51bd81c06e5afcf2de15c8be35
parentd7461830823242702f5d84084bcccb25159003f4
usb: gadget: f_fs: Fix a race condition when processing setup packets.

commit 0aea736ddb877b93f6d2dd8cf439840d6b4970a9 upstream.

If the USB driver passes a pointer into the TRB buffer for creq, this
buffer can be overwritten with the status response as soon as the event
is queued. This can make the final check return USB_GADGET_DELAYED_STATUS
when it shouldn't. Instead use the stored wLength.

Fixes: 4d644abf2569 ("usb: gadget: f_fs: Only return delayed status when len is 0")
Cc: stable <stable@kernel.org>
Signed-off-by: Chris Wulff <chris.wulff@biamp.com>
Link: https://lore.kernel.org/r/CO1PR17MB5419BD664264A558B2395E28E1112@CO1PR17MB5419.namprd17.prod.outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c