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 2834E32BF44 for ; Mon, 5 Jan 2026 09:29:00 +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=1767605341; cv=none; b=sWp5sopCv+GBYypwKgaWWeUhkCqHH8b6owWgtnQj7cmXwOA4ZAszOppz2rjYaPNZkUgDIbouy6ZlScbsUDGEnPuFOY1WSanGDsyruXlyr7jT3cL2icWTbU505L3YwFwHThR3vXD5rAyPK6bTNPL9C6o1juRTA9aHRzyv+yMdXRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767605341; c=relaxed/simple; bh=LZCVThF04OFhcteI/NYOer06D/NEeYMzqlC4aujIW+Y=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=ObHPlAzOl0tlh4erP6PhgObYEtzBt2ecfFCcwfZd5iqC5YtBD2W8w0ZicNeWQo29xBXV9tXF422l5zUeJISFGSu74osy3/XWDDPlfnyrP8vG68hLJ5RZTi628ihLlmaU++SjjEHRhtVCiGK+1TCmmt0E3nutqzczIjg+OwYF9sg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BO8OBSvA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BO8OBSvA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC45C116D0; Mon, 5 Jan 2026 09:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767605340; bh=LZCVThF04OFhcteI/NYOer06D/NEeYMzqlC4aujIW+Y=; h=Subject:To:Cc:From:Date:From; b=BO8OBSvA1TQnHNh6LuyVZw/NZZbUCjDZndze1JlhqrtTLWoZRsALjlTXp3LU9EIhb B2uJEo4VK4Nbt4vv+vtcUsTAtYeH9bd5syxbjd/WfSawchr0L2SN4X+WNuPqVb2E1G f8Z5AQ188lAHWIa92yXutvk4DjbjidJPyQFRS6bo= Subject: FAILED: patch "[PATCH] iommu/mediatek-v1: fix device leaks on probe()" failed to apply to 5.15-stable tree To: johan@kernel.org,angelogioacchino.delregno@collabora.com,honghui.zhang@mediatek.com,joerg.roedel@amd.com,robin.murphy@arm.com Cc: From: Date: Mon, 05 Jan 2026 10:28:46 +0100 Message-ID: <2026010546-sculpture-singing-a9bf@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-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 . 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-5.15.y git checkout FETCH_HEAD git cherry-pick -x 46207625c9f33da0e43bb4ae1e91f0791b6ed633 # git commit -s git send-email --to '' --in-reply-to '2026010546-sculpture-singing-a9bf@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 46207625c9f33da0e43bb4ae1e91f0791b6ed633 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 20 Oct 2025 06:53:13 +0200 Subject: [PATCH] iommu/mediatek-v1: fix device leaks on probe() Make sure to drop the references taken to the larb devices during probe on probe failure (e.g. probe deferral) and on driver unbind. Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW") Cc: stable@vger.kernel.org # 4.8 Cc: Honghui Zhang Acked-by: Robin Murphy Signed-off-by: Johan Hovold Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Joerg Roedel diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 363c61a0009c..86686455e911 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -651,8 +651,10 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev) struct platform_device *plarbdev; larbnode = of_parse_phandle(dev->of_node, "mediatek,larbs", i); - if (!larbnode) - return -EINVAL; + if (!larbnode) { + ret = -EINVAL; + goto out_put_larbs; + } if (!of_device_is_available(larbnode)) { of_node_put(larbnode); @@ -662,11 +664,14 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev) plarbdev = of_find_device_by_node(larbnode); if (!plarbdev) { of_node_put(larbnode); - return -ENODEV; + ret = -ENODEV; + goto out_put_larbs; } if (!plarbdev->dev.driver) { of_node_put(larbnode); - return -EPROBE_DEFER; + put_device(&plarbdev->dev); + ret = -EPROBE_DEFER; + goto out_put_larbs; } data->larb_imu[i].dev = &plarbdev->dev; @@ -678,7 +683,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev) ret = mtk_iommu_v1_hw_init(data); if (ret) - return ret; + goto out_put_larbs; ret = iommu_device_sysfs_add(&data->iommu, &pdev->dev, NULL, dev_name(&pdev->dev)); @@ -700,12 +705,17 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev) iommu_device_sysfs_remove(&data->iommu); out_clk_unprepare: clk_disable_unprepare(data->bclk); +out_put_larbs: + for (i = 0; i < MTK_LARB_NR_MAX; i++) + put_device(data->larb_imu[i].dev); + return ret; } static void mtk_iommu_v1_remove(struct platform_device *pdev) { struct mtk_iommu_v1_data *data = platform_get_drvdata(pdev); + int i; iommu_device_sysfs_remove(&data->iommu); iommu_device_unregister(&data->iommu); @@ -713,6 +723,9 @@ static void mtk_iommu_v1_remove(struct platform_device *pdev) clk_disable_unprepare(data->bclk); devm_free_irq(&pdev->dev, data->irq, data); component_master_del(&pdev->dev, &mtk_iommu_v1_com_ops); + + for (i = 0; i < MTK_LARB_NR_MAX; i++) + put_device(data->larb_imu[i].dev); } static int __maybe_unused mtk_iommu_v1_suspend(struct device *dev)