]> git.itanic.dy.fi Git - linux-stable/commit
usb: gadget: f_hid: fix: Prevent accessing released memory
authorKrzysztof Opasiak <kopasiak90@gmail.com>
Thu, 19 Jan 2017 17:55:28 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:41:49 +0000 (06:41 +0100)
commitd3acd94c0f79387b0d1855bdd4690f1596eb3f25
treea216f6ea6c4eee38a7626a38942f01118211fe8a
parentb6092a57150c1641dffb6bfeebbe2cbde7275d1f
usb: gadget: f_hid: fix: Prevent accessing released memory

commit aa65d11aa008f4de58a9cee7e121666d9d68505e upstream.

When we unlock our spinlock to copy data to user we may get
disabled by USB host and free the whole list of completed out
requests including the one from which we are copying the data
to user memory.

To prevent from this let's remove our working element from
the list and place it back only if there is sth left when we
finish with it.

Fixes: 99c515005857 ("usb: gadget: hidg: register OUT INT endpoint for SET_REPORT")
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_hid.c