From patchwork Sat Sep 26 08:52:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7269061 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4BBA9BEEC1 for ; Sat, 26 Sep 2015 08:52:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30E912091C for ; Sat, 26 Sep 2015 08:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B87E208D1 for ; Sat, 26 Sep 2015 08:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751826AbbIZIwU (ORCPT ); Sat, 26 Sep 2015 04:52:20 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35167 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbbIZIwT (ORCPT ); Sat, 26 Sep 2015 04:52:19 -0400 Received: by pacfv12 with SMTP id fv12so129861786pac.2; Sat, 26 Sep 2015 01:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=I/A5kt2VtXrVemYpBY47z9trlEuG00ZXdT4SVQferNQ=; b=vWgaRCgk12dq1T+GLvlFvWRrCN6hu2tbVLWEmPMY0jx46boPIo1b8uR45HS016qNiF /LfWwd7NQ0zenbIfvn0FuEgKeN0YKbaylTVnyQHn2ibG+6d/J1/8QsTPXjFYG8Q9JHVo 7jd5+ze/lzrrHg5n4bf57pqQZvpL5dDTE3gqEJ3ZvkJPGiCxnfugu0Lgu70rhLVf11Jn v88HxcNAQCofqpD26HBj8yE1pMUL1yAQwwPgfU1+czQQfBKBR+ZJscJ0iXKR0i83QOMN 1YkKb7LOqXuHOoiuhim6mfkxXMNb4nMJY/G2CezWIUTVT+VOeQluiWeXFbs/WVHFn3Yr OURQ== X-Received: by 10.66.228.97 with SMTP id sh1mr12916752pac.91.1443257538881; Sat, 26 Sep 2015 01:52:18 -0700 (PDT) Received: from localhost.localdomain ([49.206.240.178]) by smtp.gmail.com with ESMTPSA id kv9sm8097910pab.39.2015.09.26.01.52.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Sep 2015 01:52:18 -0700 (PDT) From: Sudip Mukherjee To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Sudip Mukherjee Subject: [PATCH v2] fbdev: broadsheetfb: fix memory leak Date: Sat, 26 Sep 2015 14:22:10 +0530 Message-Id: <1443257530-26848-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have requested the firmware and it was loaded but we missed releasing it both on success and error. Signed-off-by: Sudip Mukherjee --- v1: relased the firmware only on the error path. drivers/video/fbdev/broadsheetfb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 0e5fde1..9f9a7be 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c @@ -752,7 +752,7 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev, if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) { dev_err(dev, "Invalid waveform\n"); err = -EINVAL; - goto err_failed; + goto err_fw; } mutex_lock(&(par->io_lock)); @@ -762,13 +762,15 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev, mutex_unlock(&(par->io_lock)); if (err < 0) { dev_err(dev, "Failed to store broadsheet waveform\n"); - goto err_failed; + goto err_fw; } dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size); - return len; + err = len; +err_fw: + release_firmware(fw_entry); err_failed: return err; }