iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter
authorGavrilov Ilia <Ilia.Gavrilov@infotecs.ru>
Thu, 2 Feb 2023 08:26:56 +0000 (08:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:27 +0000 (09:34 +0100)
commit2ae19ac3ea82a5b87a81c10adbb497c9e58bdd60
treef9e52265713fc54f1fecf2fa6a8b40704854fb82
parent4aa738940016c8159d325209807283929e488c61
iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter

commit b6b26d86c61c441144c72f842f7469bb686e1211 upstream.

The 'acpiid' buffer in the parse_ivrs_acpihid function may overflow,
because the string specifier in the format string sscanf()
has no width limitation.

Found by InfoTeCS on behalf of Linux Verification Center
(linuxtesting.org) with SVACE.

Fixes: ca3bf5d47cec ("iommu/amd: Introduces ivrs_acpihid kernel parameter")
Cc: stable@vger.kernel.org
Signed-off-by: Ilia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
Reviewed-by: Kim Phillips <kim.phillips@amd.com>
Link: https://lore.kernel.org/r/20230202082719.1513849-1-Ilia.Gavrilov@infotecs.ru
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/amd/init.c