]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu/amd: Avoid stack buffer overflow from kernel cmdline
authorKees Cook <kees@kernel.org>
Mon, 4 Aug 2025 15:40:27 +0000 (08:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:31:13 +0000 (16:31 +0200)
commit4bdb0f78bddbfa77d3ab458a21dd9cec495d317a
treea84b39cc3724e47b176d415365cd8d53f0b2a953
parentf1424c830d6ce840341aac33fe99c8ac45447ac1
iommu/amd: Avoid stack buffer overflow from kernel cmdline

[ Upstream commit 8503d0fcb1086a7cfe26df67ca4bd9bd9e99bdec ]

While the kernel command line is considered trusted in most environments,
avoid writing 1 byte past the end of "acpiid" if the "str" argument is
maximum length.

Reported-by: Simcha Kosman <simcha.kosman@cyberark.com>
Closes: https://lore.kernel.org/all/AS8P193MB2271C4B24BCEDA31830F37AE84A52@AS8P193MB2271.EURP193.PROD.OUTLOOK.COM
Fixes: b6b26d86c61c ("iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter")
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>
Link: https://lore.kernel.org/r/20250804154023.work.970-kees@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd/init.c