USB: gadgetfs: fix copy_to_user while holding spinlock
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 21 Sep 2017 20:12:01 +0000 (16:12 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:51:15 +0000 (11:51 +0200)
commit7f850036134c491361e5297dde8762ac79934a83
tree4fdee795ffd048a755ffa5aea87814e5b39cbbf9
parentfd5336c0d1e35dfac610a5b81484f017cdc3b250
USB: gadgetfs: fix copy_to_user while holding spinlock

commit 6e76c01e71551cb221c1f3deacb9dcd9a7346784 upstream.

The gadgetfs driver as a long-outstanding FIXME, regarding a call of
copy_to_user() made while holding a spinlock.  This patch fixes the
issue by dropping the spinlock and using the dev->udc_usage mechanism
introduced by another recent patch to guard against status changes
while the lock isn't held.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/legacy/inode.c