]> git.baikalelectronics.ru Git - kernel.git/commit
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>
Fri, 22 Sep 2017 16:29:00 +0000 (18:29 +0200)
commit27f088f438564335dd42f4f09d71bf224e2485a2
tree7d82a827794b423e0e7232a87f0656f2aa5add8a
parentde4074621d70b8f5f50532b3c944ebc29a28306d
USB: gadgetfs: fix copy_to_user while holding spinlock

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>
CC: <stable@vger.kernel.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/legacy/inode.c