From patchwork Fri Jun 17 16:25:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shved X-Patchwork-Id: 892072 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5HGvwPP005821 for ; Fri, 17 Jun 2011 16:57:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757987Ab1FQQ5A (ORCPT ); Fri, 17 Jun 2011 12:57:00 -0400 Received: from smtp.ispras.ru ([83.149.198.202]:56034 "EHLO smtp.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757312Ab1FQQ47 (ORCPT ); Fri, 17 Jun 2011 12:56:59 -0400 Received: from localhost.localdomain (winnie.ispras.ru [83.149.198.236]) by smtp.ispras.ru (Postfix) with ESMTP id 497D65D40EC; Fri, 17 Jun 2011 20:19:34 +0400 (MSD) From: Pavel Shved Cc: Pavel Shved , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@ispras.ru Subject: [PATCH] hecubafb: add module_put on error path in hecubafb_probe() Date: Fri, 17 Jun 2011 20:25:12 +0400 Message-Id: <1308327913-23220-3-git-send-email-shved@ispras.ru> X-Mailer: git-send-email 1.7.0.2 In-Reply-To: <1308327913-23220-1-git-send-email-shved@ispras.ru> References: <1308327913-23220-1-git-send-email-shved@ispras.ru> To: Paul Mundt Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 17 Jun 2011 16:57:59 +0000 (UTC) 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 --- 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; }