Commit e8d35898 authored by Evgeny Novikov's avatar Evgeny Novikov Committed by Bartlomiej Zolnierkiewicz
Browse files

video: fbdev: savage: fix memory leak on error handling path in probe



savagefb_probe() calls savage_init_fb_info() that can successfully
allocate memory for info->pixmap.addr but then fail when
fb_alloc_cmap() fails. savagefb_probe() goes to label failed_init and
does not free allocated memory. It is not valid to go to label
failed_mmio since savage_init_fb_info() can fail during memory
allocation as well. So, the patch free allocated memory on the error
handling path in savage_init_fb_info() itself.

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

Signed-off-by: default avatarEvgeny Novikov <novikov@ispras.ru>
Cc: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200619162136.9010-1-novikov@ispras.ru
parent 17d8dcf5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2157,6 +2157,8 @@ static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev,
			info->flags |= FBINFO_HWACCEL_COPYAREA |
				       FBINFO_HWACCEL_FILLRECT |
				       FBINFO_HWACCEL_IMAGEBLIT;
		else
			kfree(info->pixmap.addr);
	}
#endif
	return err;