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 A8801302770 for ; Wed, 12 Nov 2025 10:26:39 +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=1762943199; cv=none; b=l+7rSE1MP5FLn7tQpZ7dHuEdbPW2eO+WKsz6DNK9aePiPMLdSrF7Ec924MmRCj15cDEwe/mCaxKFHzqDhpx+WQtz3e7In9qRC+hdoMGsqdSlwD1Ut6JKyZvMj3YI6mZa2IfQEtG6QarZSgJw7x607bfvK1LKWACg47vVjRPldEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762943199; c=relaxed/simple; bh=DpBCz0/lunEb3fTUadIdBB2vJeodam0CwnbKn2jS/TI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FWF+fEjxXabu7jW4nedyslv/P3KORr7L4LXGdxwLX4GqhUvOTZOBDI66kM03dYgElFYS9WpKoxmgRWmf5RwVhpJlgYTZgURLwJdGqhkSFyvQdWPMQviI/MXagrlgtKxMYaXYjQJsWLWm2SFPQiqjDQDRQ0ClskfyvXmhHBKkM5w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KZYRwxT8; 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="KZYRwxT8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AAF3C4CEF5; Wed, 12 Nov 2025 10:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762943199; bh=DpBCz0/lunEb3fTUadIdBB2vJeodam0CwnbKn2jS/TI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=KZYRwxT8LBa1CMWbSntDkJa8oh1AjSnq6eT/0F/B5zIwkfW1XYb6kpckrPpmxAMcE N7d22k4rDtvbEqcB6KTgtkLhQ8JP3MfifXVu840pzua16x8tL7cjSjiH/pqg+pnIOD OH7q/OEnC3RLcRkEbRzOtB1JfDdgG4/zg6Q5L2S4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40165: media: nxp: imx8-isi: m2m: Fix streaming cleanup on release Date: Wed, 12 Nov 2025 19:26:31 +0900 Message-ID: <2025111227-CVE-2025-40165-872c@gregkh> X-Mailer: git-send-email 2.51.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4899; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=hZ0y4UBlLgAWmFguiqTSxM4q30oruqp5lxhgFclFdzQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkiCVeKLM/6TEgXOfV8kcyVhwYOXw8ltezhe3xtozrbq Y6T4r+rOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiZ/QYFlwWTj/78rbKxMa5 Adl8Gnf6mtMSJzPMM3xz07rwcODXkIuMcXMvPH4q5M8RDwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: media: nxp: imx8-isi: m2m: Fix streaming cleanup on release If streamon/streamoff calls are imbalanced, such as when exiting an application with Ctrl+C when streaming, the m2m usage_count will never reach zero and the ISI channel won't be freed. Besides from that, if the input line width is more than 2K, it will trigger a WARN_ON(): [ 59.222120] ------------[ cut here ]------------ [ 59.226758] WARNING: drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c:631 at mxc_isi_channel_chain+0xa4/0x120, CPU#4: v4l2-ctl/654 [ 59.238569] Modules linked in: ap1302 [ 59.242231] CPU: 4 UID: 0 PID: 654 Comm: v4l2-ctl Not tainted 6.16.0-rc4-next-20250704-06511-gff0e002d480a-dirty #258 PREEMPT [ 59.253597] Hardware name: NXP i.MX95 15X15 board (DT) [ 59.258720] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 59.265669] pc : mxc_isi_channel_chain+0xa4/0x120 [ 59.270358] lr : mxc_isi_channel_chain+0x44/0x120 [ 59.275047] sp : ffff8000848c3b40 [ 59.278348] x29: ffff8000848c3b40 x28: ffff0000859b4c98 x27: ffff800081939f00 [ 59.285472] x26: 000000000000000a x25: ffff0000859b4cb8 x24: 0000000000000001 [ 59.292597] x23: ffff0000816f4760 x22: ffff0000816f4258 x21: ffff000084ceb780 [ 59.299720] x20: ffff000084342ff8 x19: ffff000084340000 x18: 0000000000000000 [ 59.306845] x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffffdb369e1c [ 59.313969] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [ 59.321093] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [ 59.328217] x8 : ffff8000848c3d48 x7 : ffff800081930b30 x6 : ffff800081930b30 [ 59.335340] x5 : ffff0000859b6000 x4 : ffff80008193ae80 x3 : ffff800081022420 [ 59.342464] x2 : ffff0000852f6900 x1 : 0000000000000001 x0 : ffff000084341000 [ 59.349590] Call trace: [ 59.352025] mxc_isi_channel_chain+0xa4/0x120 (P) [ 59.356722] mxc_isi_m2m_streamon+0x160/0x20c [ 59.361072] v4l_streamon+0x24/0x30 [ 59.364556] __video_do_ioctl+0x40c/0x4a0 [ 59.368560] video_usercopy+0x2bc/0x690 [ 59.372382] video_ioctl2+0x18/0x24 [ 59.375857] v4l2_ioctl+0x40/0x60 [ 59.379168] __arm64_sys_ioctl+0xac/0x104 [ 59.383172] invoke_syscall+0x48/0x104 [ 59.386916] el0_svc_common.constprop.0+0xc0/0xe0 [ 59.391613] do_el0_svc+0x1c/0x28 [ 59.394915] el0_svc+0x34/0xf4 [ 59.397966] el0t_64_sync_handler+0xa0/0xe4 [ 59.402143] el0t_64_sync+0x198/0x19c [ 59.405801] ---[ end trace 0000000000000000 ]--- Address this issue by moving the streaming preparation and cleanup to the vb2 .prepare_streaming() and .unprepare_streaming() operations. This also simplifies the driver by allowing direct usage of the v4l2_m2m_ioctl_streamon() and v4l2_m2m_ioctl_streamoff() helpers. The Linux kernel CVE team has assigned CVE-2025-40165 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit cf21f328fcafacf4f96e7a30ef9dceede1076378 and fixed in 6.6.114 with commit 50c721be2cff2bf8c9a5f1f4add35c2bbb1df302 Issue introduced in 6.4 with commit cf21f328fcafacf4f96e7a30ef9dceede1076378 and fixed in 6.12.55 with commit e8b5f4d80775835cf8192d65138e9be1ff202847 Issue introduced in 6.4 with commit cf21f328fcafacf4f96e7a30ef9dceede1076378 and fixed in 6.17.5 with commit b0d438c7b43314f9128e0dda5f83789e593e684a Issue introduced in 6.4 with commit cf21f328fcafacf4f96e7a30ef9dceede1076378 and fixed in 6.18-rc1 with commit 178aa3360220231dd91e7dbc2eb984525886c9c1 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-40165 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/50c721be2cff2bf8c9a5f1f4add35c2bbb1df302 https://git.kernel.org/stable/c/e8b5f4d80775835cf8192d65138e9be1ff202847 https://git.kernel.org/stable/c/b0d438c7b43314f9128e0dda5f83789e593e684a https://git.kernel.org/stable/c/178aa3360220231dd91e7dbc2eb984525886c9c1