* [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume
@ 2026-11-25 8:00 raoxu
2026-11-25 8:12 ` sashiko-bot
2026-11-25 8:18 ` Wentao Guan
0 siblings, 2 replies; 3+ messages in thread
From: raoxu @ 2026-11-25 8:00 UTC (permalink / raw)
To: pawell; +Cc: gregkh, peter.chen, linux-usb, linux-kernel, raoxu, stable
From: Xu Rao <raoxu@uniontech.com>
cdnsp_gadget_suspend() now always disconnects the gadget and stops
the controller, even when the link is already in U3. cdnsp_stop()
disables the slot and clears active_port, but leaves the cached
link_state unchanged.
If the controller retains its context across system suspend,
cdnsp_gadget_resume() may call __cdnsp_gadget_wakeup() based on
the stale U3 state. This dereferences active_port, which is NULL.
Port-status event handling cannot restore active_port at this
point because resume holds pdev->lock.
Remove the obsolete wakeup call from the resume path. The previous
connection has already been torn down during suspend, and
cdnsp_run() puts the enabled ports into RXDETECT. Let normal
port-status event handling establish the new connection.
Fixes: eae6460f6173 ("usb: cdnsp: fix wakeup from S3 after controller context loss")
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Cc: stable@vger.kernel.org
---
drivers/usb/cdns3/cdnsp-gadget.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index 2830b595d632..350e45f511f5 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -2160,9 +2160,6 @@ static int cdnsp_gadget_resume(struct cdns *cdns, bool lost_power)
ret = cdnsp_run(pdev, max_speed);
- if (!context_lost && pdev->link_state == XDEV_U3)
- __cdnsp_gadget_wakeup(pdev);
-
unlock:
spin_unlock_irqrestore(&pdev->lock, flags);
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume
2026-11-25 8:00 [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume raoxu
@ 2026-11-25 8:12 ` sashiko-bot
2026-11-25 8:18 ` Wentao Guan
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-25 8:12 UTC (permalink / raw)
To: raoxu; +Cc: linux-usb
> From: Xu Rao <raoxu@uniontech.com>
>
> cdnsp_gadget_suspend() now always disconnects the gadget and stops
> the controller, even when the link is already in U3. cdnsp_stop()
> disables the slot and clears active_port, but leaves the cached
> link_state unchanged.
>
> If the controller retains its context across system suspend,
> cdnsp_gadget_resume() may call __cdnsp_gadget_wakeup() based on
> the stale U3 state. This dereferences active_port, which is NULL.
> Port-status event handling cannot restore active_port at this
> point because resume holds pdev->lock.
>
> Remove the obsolete wakeup call from the resume path. The previous
> connection has already been torn down during suspend, and
> cdnsp_run() puts the enabled ports into RXDETECT. Let normal
> port-status event handling establish the new connection.
>
> Fixes: eae6460f6173 ("usb: cdnsp: fix wakeup from S3 after controller context loss")
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/7B818A718E70C344+20261125080021.3907332-1-raoxu@uniontech.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume
2026-11-25 8:00 [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume raoxu
2026-11-25 8:12 ` sashiko-bot
@ 2026-11-25 8:18 ` Wentao Guan
1 sibling, 0 replies; 3+ messages in thread
From: Wentao Guan @ 2026-11-25 8:18 UTC (permalink / raw)
To: raoxu
Cc: gregkh, linux-kernel, linux-usb, pawell, peter.chen, stable,
Wentao Guan
> cdnsp_gadget_suspend() now always disconnects the gadget and stops
> the controller, even when the link is already in U3. cdnsp_stop()
> disables the slot and clears active_port, but leaves the cached
> link_state unchanged.
>
> If the controller retains its context across system suspend,
> cdnsp_gadget_resume() may call __cdnsp_gadget_wakeup() based on
> the stale U3 state. This dereferences active_port, which is NULL.
> Port-status event handling cannot restore active_port at this
> point because resume holds pdev->lock.
>
> Remove the obsolete wakeup call from the resume path. The previous
> connection has already been torn down during suspend, and
> cdnsp_run() puts the enabled ports into RXDETECT. Let normal
> port-status event handling establish the new connection.
>
> Fixes: eae6460f6173 ("usb: cdnsp: fix wakeup from S3 after controller context loss")
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/usb/cdns3/cdnsp-gadget.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
> index 2830b595d632..350e45f511f5 100644
> --- a/drivers/usb/cdns3/cdnsp-gadget.c
> +++ b/drivers/usb/cdns3/cdnsp-gadget.c
> @@ -2160,9 +2160,6 @@ static int cdnsp_gadget_resume(struct cdns *cdns, bool lost_power)
>
> ret = cdnsp_run(pdev, max_speed);
>
> - if (!context_lost && pdev->link_state == XDEV_U3)
> - __cdnsp_gadget_wakeup(pdev);
> -
> unlock:
> spin_unlock_irqrestore(&pdev->lock, flags);
Reviewed-by: Wentao Guan <guanwentao@uniontech.com>
BRs
Wentao Guan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-25 8:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 8:00 [PATCH] usb: cdnsp: fix NULL pointer dereference during system resume raoxu
2026-11-25 8:12 ` sashiko-bot
2026-11-25 8:18 ` Wentao Guan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox