]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
video: fbdev: au1200fb: Fix a potential double free
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 9 Nov 2017 17:09:28 +0000 (18:09 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Thu, 9 Nov 2017 17:09:28 +0000 (18:09 +0100)
If 'fb_alloc_cmap()' fails, 'fbi->pseudo_palette' is freed and an error
code is returned by 'au1200fb_init_fbinfo()'.
The only caller, 'au1200fb_drv_probe()' goes to an error handling path
where resources allocated in 'fb_alloc_cmap()' are freed.
This leads to a double free of 'fbi->pseudo_palette'.

Fix it by letting the caller free all resources in case of failure in
'au1200fb_init_fbinfo()'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/au1200fb.c

index 5f04b4096c428883be0b4032fb9b055916cda5f5..a5facc2ad90b9abc8f5734aa8cde06e6147530ab 100644 (file)
@@ -1553,7 +1553,6 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
        if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
                print_err("Fail to allocate colormap (%d entries)",
                           AU1200_LCD_NBR_PALETTE_ENTRIES);
-               kfree(fbi->pseudo_palette);
                return -EFAULT;
        }