Skip to content

Commit 1382901

Browse files
Xia Fukunrodrigovivi
authored andcommitted
drm/i915/bios: fix a memory leak in generate_lfp_data_ptrs
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: a87d0a8 ("drm/i915/bios: Generate LFP data table pointers if the VBT lacks them") Signed-off-by: Xia Fukun <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 7674cd0) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 35aba5f commit 1382901

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/display/intel_bios.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915,
414414
ptrs->lvds_entries++;
415415

416416
if (size != 0 || ptrs->lvds_entries != 3) {
417-
kfree(ptrs);
417+
kfree(ptrs_block);
418418
return NULL;
419419
}
420420

0 commit comments

Comments
 (0)