lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204005452.fchcwx6ukv2xukiv@synopsys.com>
Date: Tue, 4 Feb 2025 00:54:51 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Roy Luo <royluo@...gle.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "andre.draszik@...aro.org" <andre.draszik@...aro.org>,
        "elder@...nel.org" <elder@...nel.org>,
        "stern@...land.harvard.edu" <stern@...land.harvard.edu>,
        "crwulff@...il.com" <crwulff@...il.com>,
        "paul@...pouillou.net" <paul@...pouillou.net>,
        "jkeeping@...usicbrands.com" <jkeeping@...usicbrands.com>,
        "yuanlinyu@...onor.com" <yuanlinyu@...onor.com>
Subject: Re: [PATCH v1] usb: gadget: core: flush gadget workqueue after device
 removal

On Tue, Feb 04, 2025, Roy Luo wrote:
> usb_del_gadget() can lead to new work being scheduled in gadget->work
> workqueue. This is observed, for example, with the dwc3 driver with the
> following call stack:
>   device_del()
>     gadget_unbind_driver()
>       usb_gadget_disconnect_locked()
>         dwc3_gadget_pullup()
> 	  dwc3_gadget_soft_disconnect()
> 	    usb_gadget_set_state()
> 	      schedule_work(&gadget->work)
> 
> Move flush_work() after device_del() to ensure the workqueue is cleaned
> up.
> 
> Fixes: 1ff24d40b3c3 ("usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration")

The reference should be targeting the udc core. Probably want to Cc
stable also.

BR,
Thinh

> Signed-off-by: Roy Luo <royluo@...gle.com>
> ---
>  drivers/usb/gadget/udc/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index a6f46364be65..4b3d5075621a 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -1543,8 +1543,8 @@ void usb_del_gadget(struct usb_gadget *gadget)
>  
>  	kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE);
>  	sysfs_remove_link(&udc->dev.kobj, "gadget");
> -	flush_work(&gadget->work);
>  	device_del(&gadget->dev);
> +	flush_work(&gadget->work);
>  	ida_free(&gadget_id_numbers, gadget->id_number);
>  	cancel_work_sync(&udc->vbus_work);
>  	device_unregister(&udc->dev);
> 
> base-commit: f286757b644c226b6b31779da95a4fa7ab245ef5
> -- 
> 2.48.1.362.g079036d154-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ