From nobody Thu Oct 2 02:04:53 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4518A2FE58E; Thu, 25 Sep 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758803350; cv=none; b=DTMx8/FP0156vl5GXzUL3LuE7tZY48/YvpyWCfu7HjEfdtXOb0gJYwkJvEQaCSeZ2+J7RhYvMVWJAXb9Va9oRsZ6p12bh7PA9TWHGMkwV5pzKkBhxewCgqI99Wmyhr6v6uK+vhbhwwoLEbvPptOBzo5txMP3wy+oeGTMCHYDqFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758803350; c=relaxed/simple; bh=EFeF8IqHiFjm4cF4lhsLwmIKXHBiuMuBzA6dxp8TiXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EZc/u87bn4LEknKAjOWbjwJzuSrfEk0vYyM3x18W7GfR3LSiR/VXqoiMwrC4whBoC6m/r4rPBXL1np2BNIANs8gSjMZgTiuTw7+2zkZ3hGTDiU32o3xJHdP9CbyqCGagTUH9NO/TV/kWYsSQ3SzGUWhuDDGzknvxETj9NDX+CxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tnq1/YJe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tnq1/YJe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E61BDC4AF09; Thu, 25 Sep 2025 12:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758803350; bh=EFeF8IqHiFjm4cF4lhsLwmIKXHBiuMuBzA6dxp8TiXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnq1/YJemsW9+a1oh4uzPAzDBcZmPdhBfpOuCx/XFqEP4KvixOqvob6MXMWiZlfQp GujdfVkD1PYQTyBDL5zImkAprmajVppTDbNz8HCYPIrDHEPQLsIyzn0H7sMjwQ55IH /yxlU0EWg10SlxjK046qUXZ+FWJLWFxZFPJTUwKq0p7qFpQOgWkZ89KR0Aa7Mk3XO/ /saQP2Q6QZzi0zCK7l050iCiomxon5vQ3jf6y5LsVN93kZ65nZGSHimlwMBbIm/l+F Uz81pA5NiOqmgiONhTZMrBOefaMGrhSlfQNjMVE9+92eNFRBzmVkXDLqXwRGFrBrxj ms4mIJm9F4IIA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1v1l5q-000000002rW-1plp; Thu, 25 Sep 2025 14:29:02 +0200 From: Johan Hovold To: Joerg Roedel , Will Deacon Cc: Robin Murphy , Sven Peter , Janne Grunau , Rob Clark , Marek Szyprowski , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Chen-Yu Tsai , Thierry Reding , Krishna Reddy , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 03/14] iommu/exynos: fix device leak on of_xlate() Date: Thu, 25 Sep 2025 14:27:45 +0200 Message-ID: <20250925122756.10910-4-johan@kernel.org> X-Mailer: git-send-email 2.49.1 In-Reply-To: <20250925122756.10910-1-johan@kernel.org> References: <20250925122756.10910-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure to drop the reference taken to the iommu platform device when looking up its driver data during of_xlate(). Fixes: aa759fd376fb ("iommu/exynos: Add callback for initializing devices f= rom device tree") Cc: stable@vger.kernel.org # 4.2 Cc: Marek Szyprowski Signed-off-by: Johan Hovold --- drivers/iommu/exynos-iommu.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index b6edd178fe25..ce9e935cb84c 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1446,17 +1446,14 @@ static int exynos_iommu_of_xlate(struct device *dev, return -ENODEV; =20 data =3D platform_get_drvdata(sysmmu); - if (!data) { - put_device(&sysmmu->dev); + put_device(&sysmmu->dev); + if (!data) return -ENODEV; - } =20 if (!owner) { owner =3D kzalloc(sizeof(*owner), GFP_KERNEL); - if (!owner) { - put_device(&sysmmu->dev); + if (!owner) return -ENOMEM; - } =20 INIT_LIST_HEAD(&owner->controllers); mutex_init(&owner->rpm_lock); --=20 2.49.1