drm/i915/bios: fix slab-out-of-bounds access
authorJani Nikula <jani.nikula@intel.com>
Wed, 22 Dec 2021 08:16:54 +0000 (10:16 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 23 Dec 2021 10:05:42 +0000 (12:05 +0200)
commit980f42e7d57464af190d05b9cc0bc21846734f48
tree6110f89a827cac9b965bd0e02d58b0c195c40fc5
parent825ca9ed1c9f5516b30292bb1c7ab648c2a01b92
drm/i915/bios: fix slab-out-of-bounds access

If VBT size is not a multiple of 4, the last 4-byte store will be out of
bounds of the allocated buffer. Spotted with KASAN. Round up the
allocation size.

v2: Use round_up() intead of roundup() as it's a power of 2 (Thomas)

Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Fixes: a36e7dc0af1c ("drm/i915/dg1: Read OPROM via SPI controller")
Cc: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211222081654.1843211-1-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_bios.c