mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
video: fbdev: w100fb: Fix a potential double free.
Some memory is vmalloc'ed in the 'w100fb_save_vidmem' function and freed in
the 'w100fb_restore_vidmem' function. (these functions are called
respectively from the 'suspend' and the 'resume' functions)
However, it is also freed in the 'remove' function.
In order to avoid a potential double free, set the corresponding pointer
to NULL once freed in the 'w100fb_restore_vidmem' function.
Fixes: aac51f09d9
("[PATCH] w100fb: Rewrite for platform independence")
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Antonino Daplas <adaplas@pol.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: <stable@vger.kernel.org> # v2.6.14+
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200506181902.193290-1-christophe.jaillet@wanadoo.fr
This commit is contained in:
parent
d163a95cf0
commit
18722d48a6
@ -588,6 +588,7 @@ static void w100fb_restore_vidmem(struct w100fb_par *par)
|
||||
memsize=par->mach->mem->size;
|
||||
memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_extmem, memsize);
|
||||
vfree(par->saved_extmem);
|
||||
par->saved_extmem = NULL;
|
||||
}
|
||||
if (par->saved_intmem) {
|
||||
memsize=MEM_INT_SIZE;
|
||||
@ -596,6 +597,7 @@ static void w100fb_restore_vidmem(struct w100fb_par *par)
|
||||
else
|
||||
memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_intmem, memsize);
|
||||
vfree(par->saved_intmem);
|
||||
par->saved_intmem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user