All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: Minas Harutyunyan <hminas@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Paul Zimmerman <Paul.Zimmerman@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	Jianhao Xu <jianhao.xu@seu.edu.cn>
Subject: Re: [PATCH] USB: dwc2: shut down wakeup timer before freeing HCD state
Date: Sat, 5 Sep 2026 00:37:34 +0000	[thread overview]
Message-ID: <aptkQP7nu93Z761L@vbox> (raw)
In-Reply-To: <20260904065323.4047026-1-runyu.xiao@seu.edu.cn>

On Fri, Sep 04, 2026, Runyu Xiao wrote:
> dwc2_wakeup_detected() accesses the DWC2 host state and can rearm the
> wakeup timer.  dwc2_hcd_free() currently deletes the timer only after
> freeing host-owned state, and timer_delete() does not synchronize a
> callback or prevent it from being queued again.
> 
> Stop and shut down the timer in dwc2_hcd_release(), before the HCD
> resources are freed.  This covers both the HCD initialization error path
> and normal HCD removal.
> 
> Fixes: 7359d482eb4d ("staging: HCD files for the DWC2 driver")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> 
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index 2414291aa..cd0dc876b 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -5082,14 +5082,13 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg)
>  	}
>  
>  	cancel_work_sync(&hsotg->phy_reset_work);
> -
> -	timer_delete(&hsotg->wkp_timer);
>  }
>  
>  static void dwc2_hcd_release(struct dwc2_hsotg *hsotg)
>  {
>  	/* Turn off all host-specific interrupts */
>  	dwc2_disable_host_interrupts(hsotg);
> +	timer_shutdown_sync(&hsotg->wkp_timer);
>  
>  	dwc2_hcd_free(hsotg);
>  }
> -- 
> 2.34.1
> 
> 

Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

BR,
Thinh

      reply	other threads:[~2026-09-05  0:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  6:53 [PATCH] USB: dwc2: shut down wakeup timer before freeing HCD state Runyu Xiao
2026-09-05  0:37 ` Thinh Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aptkQP7nu93Z761L@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=Paul.Zimmerman@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hminas@synopsys.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.