From patchwork Fri Mar 11 17:14:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 8568021 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 D3479C0553 for ; Fri, 11 Mar 2016 17:15:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0216220221 for ; Fri, 11 Mar 2016 17:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0583120219 for ; Fri, 11 Mar 2016 17:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933053AbcCKRO4 (ORCPT ); Fri, 11 Mar 2016 12:14:56 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33521 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932643AbcCKROx (ORCPT ); Fri, 11 Mar 2016 12:14:53 -0500 Received: by mail-pa0-f52.google.com with SMTP id fl4so103332790pad.0; Fri, 11 Mar 2016 09:14:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DzxG/D/axpptPK8MU1YvHhh+N4zJQhxXZka1kmwKbh4=; b=QwrGooB47bqvGsf/gfhkvSCGCq81oM43WrzmtO1YPgYUiWRGa9eREyMpuD5obCPPRQ 008ZFuAbUYyP1W9DwDC+3yvOebVnOrO2piCB1EI535AhgV3yoqhuhpE5tIeo9MBij6Y7 qyszL+/6URevQi7b77u9bxHYFcHM4vPbIUmXBfhCXNLREEZ49pcJQH7IjDLBHalDXj+q W2Gr9mYA2lq8iW3DkNcRc3s+ldNRMqtFg4oDUeBsqBbUMoe5xosHKZd/SEOIfmQMi9Hh SIybe8eRL+q9qBClvoxGk8P6XURp22tasn6c/bhfwHWaeJ/CCc7yEXMzHR0z2P2Cerda XGYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DzxG/D/axpptPK8MU1YvHhh+N4zJQhxXZka1kmwKbh4=; b=LSIg8mNYFC2H/FFLakeok1fhSsAPDHFz/51lP0XhCnKs5n/mhNITcHFYjB4qA1Bv+q 4/wbZHTsh2Sccdn4p2zMUPWQtTPptfgaM+bFFlEhjZ3YbbH+WYkkpzC2brTQ13KIRM4J llARyrgYEf42AjqSqO0ZtKCM6MAE8zxrDHcV1Lc+TRkhA1uAwUPY3PG4ZUVRmkOOCElM oZVl71h3lX62n3yXj55DPzo4LoSJz0k5XyNaBvK44KaYuQ6dPqmxEU9RczU3ixF5gCD/ sm7ow28gqLGVkCi8RV3qw62Lsxa3jIaa7jvgRx310XdGJ1G3e8TGaf9mC9LzagwEedne 7ojQ== X-Gm-Message-State: AD7BkJIEMhCclde8t9HC3p4x5lNfxCHWf9N3hjdCA1tImOTVcg2HiOOEWaFQYvCpthkCHw== X-Received: by 10.66.226.135 with SMTP id rs7mr17455407pac.116.1457716492548; Fri, 11 Mar 2016 09:14:52 -0800 (PST) Received: from localhost.localdomain ([103.24.124.195]) by smtp.gmail.com with ESMTPSA id ez6sm14273591pab.12.2016.03.11.09.14.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Mar 2016 09:14:52 -0800 (PST) From: Sudip Mukherjee To: Kalle Valo Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, netdev@vger.kernel.org, Jia-Ju Bai , =?UTF-8?q?Michael=20B=C3=BCsch?= Subject: [PATCH] b43: Fix memory leaks in b43_bus_dev_ssb_init and b43_bus_dev_bcma_init Date: Fri, 11 Mar 2016 22:44:37 +0530 Message-Id: <1457716477-6287-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,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 From: Jia-Ju Bai The memory allocated by kzalloc in b43_bus_dev_ssb_init and b43_bus_dev_bcma_init is not freed. This patch fixes the bug by adding kfree in b43_ssb_remove, b43_bcma_remove and error handling code of b43_bcma_probe. Thanks Michael for his suggestion. Signed-off-by: Jia-Ju Bai Acked-by: Michael Büsch Signed-off-by: Sudip Mukherjee --- drivers/net/wireless/broadcom/b43/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c index 72380af..b0603e7 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -5680,11 +5680,12 @@ static int b43_bcma_probe(struct bcma_device *core) INIT_WORK(&wl->firmware_load, b43_request_firmware); schedule_work(&wl->firmware_load); -bcma_out: return err; bcma_err_wireless_exit: ieee80211_free_hw(wl->hw); +bcma_out: + kfree(dev); return err; } @@ -5712,8 +5713,8 @@ static void b43_bcma_remove(struct bcma_device *core) b43_rng_exit(wl); b43_leds_unregister(wl); - ieee80211_free_hw(wl->hw); + kfree(wldev->dev); } static struct bcma_driver b43_bcma_driver = { @@ -5796,6 +5797,7 @@ static void b43_ssb_remove(struct ssb_device *sdev) b43_leds_unregister(wl); b43_wireless_exit(dev, wl); + kfree(dev); } static struct ssb_driver b43_ssb_driver = {