]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: f_fs: Use local copy of descriptors for userspace copy
authorVamsi Krishna Samavedam <vskrishn@codeaurora.org>
Mon, 30 Nov 2020 20:34:53 +0000 (12:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Dec 2020 12:36:44 +0000 (13:36 +0100)
commitb0e4a1bc9fbef3fb9e2f793b6236ac0151687c00
tree54bd8a5afdda511844aa35859c15bcc2f71c34c6
parentbb7b26278b384dad1423101dc69157b63968ed1c
usb: gadget: f_fs: Use local copy of descriptors for userspace copy

commit a4b98a7512f18534ce33a7e98e49115af59ffa00 upstream.

The function may be unbound causing the ffs_ep and its descriptors
to be freed while userspace is in the middle of an ioctl requesting
the same descriptors. Avoid dangling pointer reference by first
making a local copy of desctiptors before releasing the spinlock.

Fixes: c559a3534109 ("usb: gadget: f_fs: add ioctl returning ep descriptor")
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vamsi Krishna Samavedam <vskrishn@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201130203453.28154-1-jackp@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c