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: 
 <PH0PR11MB519103593845FFAA819A92F8F1C12@PH0PR11MB5191.namprd11.prod.outlook.com>
Date: Thu, 13 Jun 2024 11:59:17 +0000
From: "Li, Meng" <Meng.Li@...driver.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: "Thinh.Nguyen@...opsys.com" <Thinh.Nguyen@...opsys.com>,
        "quic_uaggarwa@...cinc.com" <quic_uaggarwa@...cinc.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: dwc3: core: remove lock of otg mode during gadget
 suspend/resume to avoid deadlock



> -----Original Message-----
> From: Greg KH <gregkh@...uxfoundation.org>
> Sent: Thursday, June 13, 2024 4:06 PM
> To: Li, Meng <Meng.Li@...driver.com>
> Cc: Thinh.Nguyen@...opsys.com; quic_uaggarwa@...cinc.com; linux-
> usb@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH] usb: dwc3: core: remove lock of otg mode during gadget
> suspend/resume to avoid deadlock
> 
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and
> know the content is safe.
> 
> On Thu, Jun 13, 2024 at 03:39:59PM +0800, Meng Li wrote:
> > When config CONFIG_USB_DWC3_DUAL_ROLE is selected, and trigger
> system
> > to enter suspend status with below command:
> > echo mem > /sys/power/state
> > There will be a deadlock issue occurring. Because
> > dwc3_gadget_suspend() also try to get the lock again when previous
> > invoked dwc3_suspend_common() has got the lock . This issue is introduced
> by commit c7ebd8149ee5 ("usb: dwc3:
> > gadget: Fix NULL pointer dereference in dwc3_gadget_suspend") that
> > removes the code of checking whether dwc->gadget_driver is NULL or
> > not. It causes the following code is executed and deadlock occurs when
> trying to get the spinlock.
> > To fix the deadlock issue, refer to commit 5265397f9442("usb: dwc3:
> > Remove
> > DWC3 locking during gadget suspend/resume"), remove lock of otg mode
> > during gadget suspend/resume.
> >
> > Fixes: 61a348857e86 ("Fix NULL pointer dereference in
> > dwc3_gadget_suspend")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Meng Li <Meng.Li@...driver.com>
> > ---
> >  drivers/usb/dwc3/core.c | 6 ------
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
> > 7ee61a89520b..9d47c3aa5777 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -2250,7 +2250,6 @@ static int dwc3_core_init_for_resume(struct
> dwc3
> > *dwc)
> >
> >  static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
> {
> > -     unsigned long   flags;
> >       u32 reg;
> >       int i;
> >
> > @@ -2293,9 +2292,7 @@ static int dwc3_suspend_common(struct dwc3
> *dwc, pm_message_t msg)
> >                       break;
> >
> >               if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) {
> > -                     spin_lock_irqsave(&dwc->lock, flags);
> >                       dwc3_gadget_suspend(dwc);
> > -                     spin_unlock_irqrestore(&dwc->lock, flags);
> >                       synchronize_irq(dwc->irq_gadget);
> >               }
> >
> > @@ -2312,7 +2309,6 @@ static int dwc3_suspend_common(struct dwc3
> *dwc,
> > pm_message_t msg)
> >
> >  static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)  {
> > -     unsigned long   flags;
> >       int             ret;
> >       u32             reg;
> >       int             i;
> > @@ -2366,9 +2362,7 @@ static int dwc3_resume_common(struct dwc3
> *dwc, pm_message_t msg)
> >               if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) {
> >                       dwc3_otg_host_init(dwc);
> >               } else if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) {
> > -                     spin_lock_irqsave(&dwc->lock, flags);
> >                       dwc3_gadget_resume(dwc);
> > -                     spin_unlock_irqrestore(&dwc->lock, flags);
> >               }
> >
> >               break;
> > --
> > 2.34.1
> >
> >
> 
> Hi,
> 
> This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him a
> patch that has triggered this response.  He used to manually respond to these
> common problems, but in order to save his sanity (he kept writing the same
> thing over and over, yet to different people), I was created.  Hopefully you will
> not take offence and will fix the problem in your patch and resubmit it so that
> it can be accepted into the Linux kernel tree.
> 
> You are receiving this message because of the following common error(s) as
> indicated below:
> 
> - This looks like a new version of a previously submitted patch, but you
>   did not list below the --- line any changes from the previous version.
>   Please read the section entitled "The canonical patch format" in the
>   kernel file, Documentation/process/submitting-patches.rst for what
>   needs to be done here to properly describe this.
> 
> If you wish to discuss this problem further, or you have questions about how
> to resolve this issue, please feel free to respond to this email and Greg will
> reply once he has dug out from the pending patches received from other
> developers.
> 

Sorry! I sent the patch of linux-stable version firstly, and then I realize my fault, so send a correct version for mainline upstream.
So, I think I received this email from patch-bot to remind me to add the --- for change log.
Let me clarify that this patch is the first version for mainline upstream. And please ignore the previous wrong one for linux-stable.

Best Regards,
Meng

> thanks,
> 
> greg k-h's patch email bot

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ