]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: dmi: Fortify entry point length checks
authorJean Delvare <jdelvare@suse.de>
Fri, 23 Sep 2022 12:53:14 +0000 (14:53 +0200)
committerJean Delvare <jdelvare@suse.de>
Fri, 23 Sep 2022 12:53:14 +0000 (14:53 +0200)
commit001f0daa2df4c535466b1f3677f46f1395f6e7c0
treeb4f3316d57f32e5bf02b2ae8c737b7f5ef9464d9
parent05bef87d4e52d4941084179068f4fb24ca7c702c
firmware: dmi: Fortify entry point length checks

Ensure that the SMBIOS entry point is long enough to include all the
fields we need. Otherwise it is pointless to even attempt to verify
its checksum.

Also fix the maximum length check, which is technically 32, not 31.
It does not matter in practice as the only valid values are 31 (for
SMBIOS 2.x) and 24 (for SMBIOS 3.x), but let's still have the check
right in case new fields are added to either structure in the future.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/lkml/20220823094857.27f3d924@endymion.delvare/T/
drivers/firmware/dmi_scan.c