usb: gadget: composite: fix delayed_status race condition when set_interface
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Fri, 25 May 2018 09:24:57 +0000 (17:24 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 19 Jun 2018 09:48:13 +0000 (12:48 +0300)
commit980900d6318066b9f8314bfb87329a20fd0d1ca4
tree46c4f425c8c91c48001af3f6447ae8d87b54512c
parent70c3c8cb83856758025c2a211dd022bc0478922a
usb: gadget: composite: fix delayed_status race condition when set_interface

It happens when enable debug log, if set_alt() returns
USB_GADGET_DELAYED_STATUS and usb_composite_setup_continue()
is called before increasing count of @delayed_status,
so fix it by using spinlock of @cdev->lock.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Tested-by: Jay Hsu <shih-chieh.hsu@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/composite.c