]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hecubafb: add module_put on error path in hecubafb_probe()
authorPavel Shved <shved@ispras.ru>
Fri, 17 Jun 2011 16:25:12 +0000 (16:25 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 24 Jun 2011 08:00:39 +0000 (17:00 +0900)
In hecubafb_probe(), after a successful try_module_get, vzalloc may
fail and make the hecubafb_probe return, but the module is not put on
this error path.

This patch adds an exit point that calls module_put in such situation.

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

Signed-off-by: Pavel Shved <shved@ispras.ru>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/hecubafb.c

index fbef15f7a21803051e778b89436cd08c2f0f0561..614251a9af912953e867802e2ddbd9a495fdee86 100644 (file)
@@ -233,7 +233,7 @@ static int __devinit hecubafb_probe(struct platform_device *dev)
 
        videomemory = vzalloc(videomemorysize);
        if (!videomemory)
-               return retval;
+               goto err_videomem_alloc;
 
        info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev);
        if (!info)
@@ -275,6 +275,7 @@ err_fbreg:
        framebuffer_release(info);
 err_fballoc:
        vfree(videomemory);
+err_videomem_alloc:
        module_put(board->owner);
        return retval;
 }