linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hecubafb: add module_put on error path in hecubafb_probe()
       [not found] <1308327913-23220-1-git-send-email-shved@ispras.ru>
@ 2011-06-17 16:25 ` Pavel Shved
  2011-06-24  8:02   ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Shved @ 2011-06-17 16:25 UTC (permalink / raw)
  To: Paul Mundt; +Cc: Pavel Shved, linux-fbdev, linux-kernel, ldv-project

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>
---
 drivers/video/hecubafb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c
index fbef15f..614251a 100644
--- a/drivers/video/hecubafb.c
+++ b/drivers/video/hecubafb.c
@@ -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;
 }
-- 
1.7.0.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hecubafb: add module_put on error path in hecubafb_probe()
  2011-06-17 16:25 ` [PATCH] hecubafb: add module_put on error path in hecubafb_probe() Pavel Shved
@ 2011-06-24  8:02   ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-06-24  8:02 UTC (permalink / raw)
  To: Pavel Shved; +Cc: linux-fbdev, linux-kernel, ldv-project

On Fri, Jun 17, 2011 at 08:25:12PM +0400, Pavel Shved wrote:
> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-24  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1308327913-23220-1-git-send-email-shved@ispras.ru>
2011-06-17 16:25 ` [PATCH] hecubafb: add module_put on error path in hecubafb_probe() Pavel Shved
2011-06-24  8:02   ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).