Skip to contentSkip to conversation

FAILED: patch "[PATCH] usb: typec: qcom-pmic: fix use-after-free on late probe" failed to apply to 6.8-stable tree

PATCH [email protected] 1 participant 1 message May 13, 2024

Subsystems (5)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.8-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.8.y
git checkout FETCH_HEAD
git cherry-pick -x d80eee97cb4e90768a81c856ac71d721996d86b7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024051320-bleep-cure-25ea@gregkh' --subject-prefix 'PATCH 6.8.y' HEAD^..

Possible dependencies:

d80eee97cb4e ("usb: typec: qcom-pmic: fix use-after-free on late probe errors")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From d80eee97cb4e90768a81c856ac71d721996d86b7 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 18 Apr 2024 16:57:29 +0200
Subject: [PATCH] usb: typec: qcom-pmic: fix use-after-free on late probe
errors

Make sure to stop and deregister the port in case of late probe errors to avoid use-after-free issues when the underlying memory is released by devres.

drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +6 -2
index e48412cdcb0f..d3958c061a97 100644
@@ -104,14 +104,18 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
 
 	ret = tcpm->port_start(tcpm, tcpm->tcpm_port);
 	if (ret)
-		goto fwnode_remove;
+		goto port_unregister;
 
 	ret = tcpm->pdphy_start(tcpm, tcpm->tcpm_port);
 	if (ret)
-		goto fwnode_remove;
+		goto port_stop;
 
 	return 0;
 
+port_stop:
+	tcpm->port_stop(tcpm);
+port_unregister:
+	tcpm_unregister_port(tcpm->tcpm_port);
 fwnode_remove:
 	fwnode_remove_software_node(tcpm->tcpc.fwnode);