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>] [day] [month] [year] [list]
Message-ID: <20260204141131.2451382-1-Victoria.Votokina@kaspersky.com>
Date: Wed, 4 Feb 2026 17:11:30 +0300
From: Votokina Victoria <Victoria.Votokina@...persky.com>
To: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
CC: Votokina Victoria <Victoria.Votokina@...persky.com>, Greg Kroah-Hartman
	<gregkh@...uxfoundation.org>, Roger Quadros <rogerq@...nel.org>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<lvc-project@...uxtesting.org>
Subject: [PATCH] usb: dwc3: am62: handle usb2_refclk enable failures

The AM62 DWC3 glue enables usb2_refclk via clk_prepare_enable(), but
the return value was ignored in the init path. If the clock cannot be
enabled (including -EPROBE_DEFER), the driver continues and may access
the controller/PHY in an undefined state.

Also check dwc3_ti_init() return value on resume when power/context was
lost.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 31d500c2d0d4 ("usb: dwc3: dwc3-am62: Re-initialize controller if lost power in PM suspend")
Signed-off-by: Votokina Victoria <Victoria.Votokina@...persky.com>
---
 drivers/usb/dwc3/dwc3-am62.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
index e11d7643f966..d8b35098e921 100644
--- a/drivers/usb/dwc3/dwc3-am62.c
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -205,7 +205,9 @@ static int dwc3_ti_init(struct dwc3_am62 *am62)
 
 	dwc3_ti_writel(am62, USBSS_PHY_CONFIG, reg);
 
-	clk_prepare_enable(am62->usb2_refclk);
+	ret = clk_prepare_enable(am62->usb2_refclk);
+	if (ret)
+		return dev_err_probe(am62->dev, ret, "failed to enable usb2_refclk\n");
 
 	/* Set mode valid bit to indicate role is valid */
 	reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
@@ -361,14 +363,17 @@ static int dwc3_ti_resume_common(struct device *dev)
 {
 	struct dwc3_am62 *am62 = dev_get_drvdata(dev);
 	u32 reg;
+	int ret;
 
 	reg = dwc3_ti_readl(am62, USBSS_DEBUG_CFG);
 	if (reg != USBSS_DEBUG_CFG_DISABLED) {
 		/* lost power/context */
-		dwc3_ti_init(am62);
+		return dwc3_ti_init(am62);
 	} else {
+		ret = clk_prepare_enable(am62->usb2_refclk);
+		if (ret)
+			return ret;
 		dwc3_ti_writel(am62, USBSS_DEBUG_CFG, USBSS_DEBUG_CFG_OFF);
-		clk_prepare_enable(am62->usb2_refclk);
 	}
 
 	if (device_may_wakeup(dev)) {
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ