From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386104; b=Qx/WQzqG1r1t4k3cjqRNlPGIMe/gUrO4aLaFhj+mKx4eROT3JP/JUTQlH8Qbn259vg0p HISpXf2BeHgQGaAXRL48kBz8QYdgt9tM9fxRIDAD+XvpYPzIOVVkMdK8tU47P1X+iVoNw 3MlOfJmvMu2sV3aqep9vVGs+dURphP9SFX02T1adyLzTr31oJvDJeNvkgHOHlNLexaOVj 2e56KhtuvYlr8Q7cmswjlIPUzVOZf5ZMZBFyxNP9WyATfsEvG67Hjkz1f1+B3cl0bKgVM cIIuMY+BTWewDDCq1MCD7BKfxbkn4fGBvISusDajJrbn0x9sWvsM26lVMVbo5v5ydAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386104; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EcDWqAlHzbWhSzYaAjtpIrhyb1MO+agFWxLAjGITPuY=; b=g4eHSXXtzWLdKktBdzDVXMgENdc/R7+sfw4Vd4pR2sAVdX/mOS64rS97iZTCs4S6Z/px W7hfexZrh2ls0Kn1fnvRgq5lvsB8OY3p0+WR2sXT/kL50KLxXqjU6zJgzOx2kstebFUm/ YUoCJHbpKQC/rhYNzY7y/KD/mcWSh2ckJSTkSj5RZhWHxgGQHZChxtAbu65O8BdwYiKvg AQvOzfPchO8Shw2xYUEYJylPRXRFFdlwkSOGtiaAbUa8tAFlejZAdEKe0eDPvKyiXxphq POYP4zHyeAb91Hnu67NuOPNo5bl/O9ecoEP9/BItiVbOvQmcDlxTacTF3G+qe6PvArQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="Wc/umMMW"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACD10606A322; Fri, 4 Dec 2026 12:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Wc/umMMW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2668A1F000C2; Fri, 4 Dec 2026 12:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386104; bh=EcDWqAlHzbWhSzYaAjtpIrhyb1MO+agFWxLAjGITPuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wc/umMMWw7fEC+TI4/r4e9MyqKTaPoy60nv4zhXdapSMSSlQIYtluOrvgxJyF83tB 4Gr1OTWI03zEmbt8Lz3HOBBkuOsCj+fpHzXUgqvw4hXK9tjhPWxDzD4rmwHVCBWdv6 oVec5IqP+pibqPIKhPk7gP00QwlXkLo/gGUlELFs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryan ODonoghue , Johan Hovold , Dmitry Baryshkov , Heikki Krogerus , Dickson Wu , Sasha Levin Subject: [PATCH 6.6 0829/1167] usb: typec: qcom-pmic: fix use-after-free on late probe errors Date: Fri, 4 Dec 2026 19:04:16 +0900 Message-ID: <20261204100723.715740423@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit d80eee97cb4e90768a81c856ac71d721996d86b7 upstream. 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. Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Cc: stable@vger.kernel.org # 6.5 Cc: Bryan O'Donoghue Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov Reviewed-by: Bryan O'Donoghue Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20240418145730.4605-2-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman [ adapted to 6.6.y: use direct port helpers and fwnode_handle_put() ] Signed-off-by: Dickson Wu Signed-off-by: Sasha Levin --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 5f67925a19d3b..a8fc86099f329 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -258,15 +258,19 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto port_unregister; ret = qcom_pmic_typec_pdphy_start(tcpm->pmic_typec_pdphy, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto port_stop; return 0; +port_stop: + qcom_pmic_typec_port_stop(tcpm->pmic_typec_port); +port_unregister: + tcpm_unregister_port(tcpm->tcpm_port); fwnode_remove: fwnode_handle_put(tcpm->tcpc.fwnode); -- 2.53.0