Skip to content

Commit dc14469

Browse files
eunovmgregkh
authored andcommitted
video: fbdev: neofb: fix memory leak in neo_scan_monitor()
[ 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 <novikov@ispras.ru> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novikov@ispras.ru Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 98d7ab7 commit dc14469

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/video/fbdev/neofb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
18201820
#else
18211821
printk(KERN_ERR
18221822
"neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n");
1823+
kfree(info->monspecs.modedb);
18231824
return -1;
18241825
#endif
18251826
default:

0 commit comments

Comments
 (0)