]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
usb: gadget: configfs: Fix missing spin_lock_init()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 30 Oct 2019 03:40:46 +0000 (03:40 +0000)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:31 +0000 (14:22 -0300)
BugLink: https://bugs.launchpad.net/bugs/1857158
commit 093edc2baad2c258b1f55d1ab9c63c2b5ae67e42 upstream.

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>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20191030034046.188808-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/usb/gadget/configfs.c

index 19ae84240738f3f2c1086619b5dcfcf4d41a1920..db3686ec4d9b486e403dcfd1b04047024cf2da59 100644 (file)
@@ -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);