Linux USB
 help / color / mirror / Atom feed
* [PATCH -next] usb: gadget: configfs: Fix missing spin_lock_init()
@ 2019-10-30  3:40 Wei Yongjun
  2019-10-30  8:11 ` Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2019-10-30  3:40 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Peter Chen
  Cc: Wei Yongjun, linux-usb, kernel-janitors

The driver allocates the spinlock but not initialize it.
Use spin_lock_init() on it to initialize it correctly.

This is detected by Coccinelle semantic patch.

Fixes: 1a1c851bbd70 ("usb: gadget: configfs: fix concurrent issue between composite APIs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/usb/gadget/configfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 33852c2b29d1..ab9ac48a751a 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1544,6 +1544,7 @@ static struct config_group *gadgets_make(
 	gi->composite.resume = NULL;
 	gi->composite.max_speed = USB_SPEED_SUPER;
 
+	spin_lock_init(&gi->spinlock);
 	mutex_init(&gi->lock);
 	INIT_LIST_HEAD(&gi->string_list);
 	INIT_LIST_HEAD(&gi->available_func);




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-20 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-30  3:40 [PATCH -next] usb: gadget: configfs: Fix missing spin_lock_init() Wei Yongjun
2019-10-30  8:11 ` Peter Chen
2019-11-18  9:09   ` Peter Chen
2019-11-20 19:47     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox