Skip to content

Commit

Permalink
hecubafb: add module_put on error path in hecubafb_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Shved authored and Paul Mundt committed Jun 24, 2011
1 parent 9845afc commit 2916001
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/video/hecubafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -275,6 +275,7 @@ static int __devinit hecubafb_probe(struct platform_device *dev)
framebuffer_release(info);
err_fballoc:
vfree(videomemory);
err_videomem_alloc:
module_put(board->owner);
return retval;
}
Expand Down

0 comments on commit 2916001

Please sign in to comment.