From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Robin Murphy" <robin.murphy@arm.com>,
"Joerg Roedel" <jroedel@suse.de>,
"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.1.y 1/5] iommu/arm-smmu: Drop if with an always false condition
Date: Mon, 5 Jan 2026 10:44:49 -0500 [thread overview]
Message-ID: <20260105154453.2644685-1-sashal@kernel.org> (raw)
In-Reply-To: <2026010519-padlock-footman-35a7@gregkh>
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[ Upstream commit a2972cb89935160bfe515b15d28a77694723ac06 ]
The remove and shutdown callback are only called after probe completed
successfully. In this case platform_set_drvdata() was called with a
non-NULL argument and so smmu is never NULL. Other functions in this
driver also don't check for smmu being non-NULL before using it.
Also note that returning an error code from a remove callback doesn't
result in the device staying bound. It's still removed and devm allocated
resources are freed (among others *smmu and the register mapping). So
after an early exit to iommu device stayed around and using it probably
oopses.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20230321084125.337021-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Stable-dep-of: 6a3908ce56e6 ("iommu/qcom: fix device leak on of_xlate()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/arm/arm-smmu/arm-smmu.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 294120049750..fcd2cfd12e7f 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -2209,9 +2209,6 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev)
{
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
- if (!smmu)
- return;
-
if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS))
dev_notice(&pdev->dev, "disabling translation\n");
@@ -2232,9 +2229,6 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
{
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
- if (!smmu)
- return -ENODEV;
-
iommu_device_unregister(&smmu->iommu);
iommu_device_sysfs_remove(&smmu->iommu);
--
2.51.0
next prev parent reply other threads:[~2026-01-05 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 9:29 FAILED: patch "[PATCH] iommu/qcom: fix device leak on of_xlate()" failed to apply to 6.1-stable tree gregkh
2026-01-05 15:44 ` Sasha Levin [this message]
2026-01-05 15:44 ` [PATCH 6.1.y 2/5] iommu/arm-smmu: Convert to platform remove callback returning void Sasha Levin
2026-01-05 15:44 ` [PATCH 6.1.y 3/5] iommu/qcom: Use the asid read from device-tree if specified Sasha Levin
2026-01-05 15:44 ` [PATCH 6.1.y 4/5] iommu/qcom: Index contexts by asid number to allow asid 0 Sasha Levin
2026-01-05 15:44 ` [PATCH 6.1.y 5/5] iommu/qcom: fix device leak on of_xlate() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260105154453.2644685-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jroedel@suse.de \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox