]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/udl: Validate length in vendor-descriptor parser
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 10 Apr 2025 10:59:05 +0000 (12:59 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 14 Apr 2025 08:19:20 +0000 (10:19 +0200)
commitdf6dc12e5e6ddbf2a59d5283fcf6ccd0b3d0334d
treedaf2e589b00488623c47a1f1174f0630296505cd
parentf4fce9ea8473ab8f91c0aa0855b9d51313b8000e
drm/udl: Validate length in vendor-descriptor parser

Rewrite the parser for the vendor firmware descriptor with the
following improvements.

- Validate the key-value length given in a vendor descriptor
against the length of the descriptor. The current code fails
to do this and might read more bytes than available. This can
lead to out-of-bounds reads of the allocated buffer.

- Read raw data with helpers for unaligned data. This allows
the code to run on platforms that do now support unaligned memory
access by default.

- Validate the pixel limit against a default value. The default
comes from real-world devices. If the reported number of pixels
is significantly above the limit, it is likely invalid.

- Drop the obsolete print macros. There is still a warning about
invalid firmware descriptors. The rest of the output is bogus.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://lore.kernel.org/r/20250410105948.25463-9-tzimmermann@suse.de
drivers/gpu/drm/udl/udl_main.c