From patchwork Sat Jan 16 13:08:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 8049041 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C6B779F6FA for ; Sat, 16 Jan 2016 13:08:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBC4E2034C for ; Sat, 16 Jan 2016 13:08:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26FA520328 for ; Sat, 16 Jan 2016 13:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751918AbcAPNIt (ORCPT ); Sat, 16 Jan 2016 08:08:49 -0500 Received: from m12-12.163.com ([220.181.12.12]:60709 "EHLO m12-12.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbcAPNIs (ORCPT ); Sat, 16 Jan 2016 08:08:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=M7TLvzv//KTbpj41Pu RNUYEFZhdyPftdfw+6UyHFVlg=; b=bMxdJUZWLZqCEYL6owzrMmPalHjylPtrWh cjfDTddBVE6DMaSD3FYj5vL9a9L5Yy2zrGF8GZg1wDuJCR2D2aF/MJxkpEG9Yjjz 8DNXuNksmh+wPqV6N+tvyQ5Z6iruMK9bLkU26hkSBUhEN+dVOXFRVMYTdMxtaiWO arDJpr4j8= Received: from bai-oslab.tsinghua.edu.cn (unknown [166.111.70.23]) by smtp8 (Coremail) with SMTP id DMCowAAHKoSUQJpWV94oAQ--.64354S2; Sat, 16 Jan 2016 21:07:35 +0800 (CST) From: Jia-Ju Bai To: kvalo@codeaurora.org, zajec5@gmail.com, joe@perches.com, davem@davemloft.net, m@bues.ch, johannes.berg@intel.com Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, netdev@vger.kernel.org, Jia-Ju Bai Subject: [PATCH v2 resend] b43: Fix memory leaks in b43_bus_dev_ssb_init and b43_bus_dev_bcma_init Date: Sat, 16 Jan 2016 21:08:10 +0800 Message-Id: <1452949690-16387-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: DMCowAAHKoSUQJpWV94oAQ--.64354S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7trykJryrXr4Uur4kCF13twb_yoW8GF15pF 4DGa42kw4xGr15C3yrAFs2yF15Wan2yrWq9FW2v39a9395Ar1Fk34UAFyfZryYyFW8Cay3 ZFWUt34UuFWDJFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UEeHgUUUUU= X-Originating-IP: [166.111.70.23] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/xtbBRRjxelO-zsAPFAAAsv Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,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 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 Tested-by: Sudip Mukherjee --- drivers/net/wireless/b43/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ec013fb..bbea769 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -5682,11 +5682,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; } @@ -5714,8 +5715,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 = { @@ -5798,6 +5799,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 = {