Skip to contentSkip to conversation

patch "usb: cdnsp: Fix segmentation fault in cdns_lost_power function" added to usb-linus

PATCH [email protected] 1 participant 1 message Jan 26, 2022

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: cdnsp: Fix segmentation fault in cdns_lost_power function

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 79aa3e19fe8f5be30e846df8a436bfe306e8b1a6 Mon Sep 17 00:00:00 2001
From: Pawel Laszczak <[email protected]>
Date: Tue, 11 Jan 2022 10:07:37 +0100
Subject: usb: cdnsp: Fix segmentation fault in cdns_lost_power function

CDNSP driver read not initialized cdns->otg_v0_regs which lead to segmentation fault. Patch fixes this issue.

Fixes 2cf2581cd229 ("usb: cdns3: add power lost support for system resume")
---
 drivers/usb/cdns3/drd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/cdns3/drd.c +3 -3
index 55c73b1d8704..d00ff98dffab 100644
@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns)
 /* Indicate the cdns3 core was power lost before */
 bool cdns_power_is_lost(struct cdns *cdns)
 {
-	if (cdns->version == CDNS3_CONTROLLER_V1) {
-		if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
+	if (cdns->version == CDNS3_CONTROLLER_V0) {
+		if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
 			return true;
 	} else {
-		if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
+		if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
 			return true;
 	}
 	return false;
Signature · 1 line
2.35.0