Skip to content

Commit

Permalink
video: fbdev: neofb: fix memory leak in neo_scan_monitor()
Browse files Browse the repository at this point in the history
[ Upstream commit edcb389 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
eunovm authored and gregkh committed Aug 19, 2020
1 parent 98d7ab7 commit dc14469
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/video/fbdev/neofb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
#else
printk(KERN_ERR
"neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n");
kfree(info->monspecs.modedb);
return -1;
#endif
default:
Expand Down

0 comments on commit dc14469

Please sign in to comment.