From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5F142346A0C; Tue, 21 Jul 2026 20:31:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665886; cv=none; b=kXoaxx5c8CDFwD7A3yox4qBkgARyNOP/gEcpIuB2+3bNL0E2pW1qgWQO2gN8mTAzfI+rFRo6r9mjINvlF1Mlx1ay6WeCpYIkUAnay6X8/BLbbgAoaxWckTMvb/HFMiVn8BzTHMI8K+AiRLTpTVmKI18162CHlDHq0QP3MJSkSKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665886; c=relaxed/simple; bh=0f1ARo5frfb2pBpPSv9KDuiydbl2DaPkren7xSaZlm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k3G8edDix5v+cod3fHRzbXdtjhrdi/Obd0WOdsAbKYgssP861LGarh0GLCe4TnIX3fvfDofxJi7oXx8t07xoNWIC2jTeYzzteY2y85Y/9CAXzFAnWomIb/86Tq4EBCJLaC0/wYmxh0llpy0N34qucQeVgQprxw/jUzVnQyE+Ia8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a5UnCmA0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="a5UnCmA0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52761F000E9; Tue, 21 Jul 2026 20:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665885; bh=jNXzBVPM1duLxKqV5jtBx+CRIFKeTfFk20a1tpMxyBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a5UnCmA0q/dHWAHZAOAJXmSCN38uRE8uTctetQ+UWUM46dVIJ4Z77njUMQL/y7Vtp 9ne3HPtdUHSzmg1LW1tqJWadvBu0aQ+JdRPYBPwvEnRzlRIUYTv0TTHh6ZGNLsJNK7 Z2W8tw79BafGJcq/ar8DIKlzsBTWouNc5AqBQUgU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuho Choi , Frank Li , Sasha Levin Subject: [PATCH 6.6 0474/1266] ARM: imx31: Fix IIM mapping leak in revision check Date: Tue, 21 Jul 2026 17:15:11 +0200 Message-ID: <20260721152452.442117489@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi [ Upstream commit ccb4b54b8ecf1ebafef96d538cd6c5c8455bb390 ] mx31_read_cpu_rev() maps the IIM registers with of_iomap() to read the silicon revision, but returns without unmapping the MMIO mapping. Keep the normalized revision value in a local variable and route the return path through iounmap() after the revision register has been read. Fixes: 3172225d45bd ("ARM: imx31: Retrieve the IIM base address from devicetree") Signed-off-by: Yuho Choi Signed-off-by: Frank Li Signed-off-by: Sasha Levin --- arch/arm/mach-imx/cpu-imx31.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/cpu-imx31.c b/arch/arm/mach-imx/cpu-imx31.c index 35c544924e5095..e81ef9e36a1fab 100644 --- a/arch/arm/mach-imx/cpu-imx31.c +++ b/arch/arm/mach-imx/cpu-imx31.c @@ -36,6 +36,7 @@ static int mx31_read_cpu_rev(void) void __iomem *iim_base; struct device_node *np; u32 i, srev; + int rev = IMX_CHIP_REVISION_UNKNOWN; np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim"); iim_base = of_iomap(np, 0); @@ -48,13 +49,17 @@ static int mx31_read_cpu_rev(void) for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++) if (srev == mx31_cpu_type[i].srev) { + rev = mx31_cpu_type[i].rev; imx_print_silicon_rev(mx31_cpu_type[i].name, mx31_cpu_type[i].rev); - return mx31_cpu_type[i].rev; + goto out; } imx_print_silicon_rev("i.MX31", IMX_CHIP_REVISION_UNKNOWN); - return IMX_CHIP_REVISION_UNKNOWN; + +out: + iounmap(iim_base); + return rev; } int mx31_revision(void) -- 2.53.0