Commit bcffd2e
committed
iommu/amd: Fix potential buffer overflow in parse_ivrs_acpihid
commit 8dee308
Author: Pavel Paklov <[email protected]>
Date: Tue Mar 25 09:22:44 2025 +0000
iommu/amd: Fix potential buffer overflow in parse_ivrs_acpihid
There is a string parsing logic error which can lead to an overflow of hid
or uid buffers. Comparing ACPIID_LEN against a total string length doesn't
take into account the lengths of individual hid and uid buffers so the
check is insufficient in some cases. For example if the length of hid
string is 4 and the length of the uid string is 260, the length of str
will be equal to ACPIID_LEN + 1 but uid string will overflow uid buffer
which size is 256.
The same applies to the hid string with length 13 and uid string with
length 250.
Check the length of hid and uid strings separately to prevent
buffer overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: ca3bf5d ("iommu/amd: Introduces ivrs_acpihid kernel parameter")
Cc: [email protected]
Signed-off-by: Pavel Paklov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
(cherry picked from commit 8dee308)
Signed-off-by: Jerry Snitselaar <[email protected]>
Upstream-Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
JIRA: https://issues.redhat.com/browse/RHEL-898911 parent 297e1d7 commit bcffd2e
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3638 | 3638 | | |
3639 | 3639 | | |
3640 | 3640 | | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
3641 | 3649 | | |
3642 | 3650 | | |
3643 | 3651 | | |
| |||
0 commit comments