]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/i915/bios: fix a memory leak in generate_lfp_data_ptrs
authorXia Fukun <xiafukun@huawei.com>
Fri, 25 Nov 2022 06:34:28 +0000 (14:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:05 +0000 (13:26 +0100)
commit4758d04014cfe6cdb6e9b4738d1d6728487bbb3a
treed3ce68b1fd4b695f9cd53fb6034cc486d9dab5a0
parent7356d8e367d0e025a568e369c4cf575722cac60f
drm/i915/bios: fix a memory leak in generate_lfp_data_ptrs

[ Upstream commit 1382901f75a5a7dc8eac05059fd0c7816def4eae ]

When (size != 0 || ptrs->lvds_ entries != 3), the program tries to
free() the ptrs. However, the ptrs is not created by calling kzmalloc(),
but is obtained by pointer offset operation.
This may lead to memory leaks or undefined behavior.

Fix this by replacing the arguments of kfree() with ptrs_block.

Fixes: a87d0a847607 ("drm/i915/bios: Generate LFP data table pointers if the VBT lacks them")
Signed-off-by: Xia Fukun <xiafukun@huawei.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221125063428.69486-1-xiafukun@huawei.com
(cherry picked from commit 7674cd0b7d28b952151c3df26bbfa7e07eb2b4ec)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/i915/display/intel_bios.c