mbxfb_remove: fix null pointer dereference
PATCH 1/1 mbxfb_remove: fix null pointer dereference
Function mbxfb_debugfs_remove() accesses fbi->par without NULL check, hence do the NULL check in the caller mbxfb_remove().
Signed-off-by Gaurav Singh <[email protected]>
--- drivers/video/fbdev/mbx/mbxfb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/mbx/mbxfb.c +1 -2
@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)write_reg_dly (SYSRST_RST ,SYSRST ); -mbxfb_debugfs_remove (fbi); -if (fbi) {struct mbxfb_info *mfbi = fbi->par; +mbxfb_debugfs_remove (fbi);unregister_framebuffer (fbi);if (mfbi) {if (mfbi->platform_remove)
Signature · 1 line
2.17.1
Quoted 3 lines · Gaurav Singh
Function
mbxfb_debugfs_remove()accessesfbi->parwithout NULL check, hence do the NULL check in the callermbxfb_remove().
...
drivers/video/fbdev/mbx/mbxfb.c static int mbxfb_remove(struct platform_device *dev) · line 1016
Quoted 8 lines
drivers/video/fbdev/mbx/mbxfb.c +0
-2@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)write_reg_dly (SYSRST_RST ,SYSRST ); -mbxfb_debugfs_remove (fbi); -if (fbi) {
Can you explain how this is NULL on ->remove()?
I bet this check is simply redundant. But you have to check and update commit message accordingly.
Quoted 6 lines
drivers/video/fbdev/mbx/mbxfb.c +1
-0struct mbxfb_info *mfbi = fbi->par; +mbxfb_debugfs_remove (fbi);unregister_framebuffer (fbi);if (mfbi) {if (mfbi->platform_remove)
Signature · 2 lines
With Best Regards, Andy Shevchenko