From patchwork Wed Oct 28 01:52:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 311200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7429C4363A for ; Wed, 28 Oct 2020 21:50:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91A7A2064C for ; Wed, 28 Oct 2020 21:50:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="eNsntGMq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbgJ1Vub (ORCPT ); Wed, 28 Oct 2020 17:50:31 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:56688 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbgJ1Vtv (ORCPT ); Wed, 28 Oct 2020 17:49:51 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20201028015037epoutp026055c70b2cfe7d5aba67b72c2f22cad1~CBO30ox6v2149421494epoutp027 for ; Wed, 28 Oct 2020 01:50:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20201028015037epoutp026055c70b2cfe7d5aba67b72c2f22cad1~CBO30ox6v2149421494epoutp027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1603849837; bh=XlTmgcFRTKSPsuEfcMy+F63TXyvoyD4ogFdij9pRF/k=; h=From:To:Cc:Subject:Date:References:From; b=eNsntGMqL8KQAYN4+pB3NuB9TwMgFFKtgJpjokcmcr5hu4btL1i5hBNgibgssE+kV 9DqCAkz/T1B9XVLpXllIb+0Z5cZdKyjFq/5/mv1hZKGbs0C/5p2Pw1W7AHsCQbUT5H +D4cRWu2tzUP8AKoipFlfEp6VkHb1tm7YCkx2K9w= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20201028015036epcas1p2b1be0b0896a5b9e9d4ae3b7ea9f2ca1f~CBO3ML-fq2392723927epcas1p20; Wed, 28 Oct 2020 01:50:36 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.40.153]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4CLWk15kfszMqYl3; Wed, 28 Oct 2020 01:50:33 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 16.D8.02418.96EC89F5; Wed, 28 Oct 2020 10:50:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20201028015033epcas1p4f3d9b38b037ff6d4432e1a2866544e38~CBOz4yoMj1110511105epcas1p4B; Wed, 28 Oct 2020 01:50:33 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201028015033epsmtrp114d0e06e788eb5bbc5386fe065d9f5eb~CBOz3krpe0215602156epsmtrp1O; Wed, 28 Oct 2020 01:50:33 +0000 (GMT) X-AuditID: b6c32a35-c23ff70000010972-dd-5f98ce69cdb9 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id C8.B3.08745.86EC89F5; Wed, 28 Oct 2020 10:50:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.113.221.222]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201028015032epsmtip153ed2103d33ac191a8e49e8aea265a1a~CBOzgzDvn0587005870epsmtip1d; Wed, 28 Oct 2020 01:50:32 +0000 (GMT) From: Seung-Woo Kim To: arend.vanspriel@broadcom.com, franky.lin@broadcom.com, hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com, wright.feng@cypress.com, kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com Cc: smoch@web.de, sandals@crustytoothpaste.net, rafal@milecki.pl, digetx@gmail.com, double.lo@cypress.com, amsr@cypress.com, stanley.hsu@cypress.com, saravanan.shanmugham@cypress.com, jean-philippe@linaro.org, frank.kao@cypress.com, netdev@vger.kernel.org, sw0312.kim@samsung.com, jh80.chung@samsung.com Subject: [PATCH v2] brcmfmac: Fix memory leak for unpaired brcmf_{alloc/free} Date: Wed, 28 Oct 2020 10:52:47 +0900 Message-Id: <1603849967-22817-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKJsWRmVeSWpSXmKPExsWy7bCmrm7muRnxBnv3alvsPfSH1WL70jcs Fp9b2pgs3k78wGbxtn0ak8Wc8y0sFqs/Pma0OHflN7tF/6cZzBY/Fr1gs/jx6AaLRcPqC6wW N361sVpc2NbHarFo5UI2izcr7rBbHFsgZrF77SImi7aZP5gsNq4Ks5h1exKrxb3WPUwWMya/ ZLOY/mM3k4OEx6z7Z9k8Lvf1Mnksv/mXyaOtKdNjy8qbTB47Z91l99i0qpPN4861PWwe56d6 evR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A== X-CMS-MailID: 20201028015033epcas1p4f3d9b38b037ff6d4432e1a2866544e38 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20201028015033epcas1p4f3d9b38b037ff6d4432e1a2866544e38 References: Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org There are missig brcmf_free() for brcmf_alloc(). Fix memory leak by adding missed brcmf_free(). Reported-by: Jaehoon Chung Fixes: commit 450914c39f88 ("brcmfmac: split brcmf_attach() and brcmf_detach() functions") Signed-off-by: Seung-Woo Kim Reviewed-by: Arend van Spriel --- Change from v1 [1] - add Fixes tag for the commit creating brcmf_alloc/free and unpaired path - add Reviewd-by tag from Arend [1] https://lore.kernel.org/linux-wireless/1603795630-14638-1-git-send-email-sw0312.kim@samsung.com/ --- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++-- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 39381cb..d8db0db 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1936,16 +1936,18 @@ static void brcmf_pcie_setup(struct device *dev, int ret, fwreq = brcmf_pcie_prepare_fw_request(devinfo); if (!fwreq) { ret = -ENOMEM; - goto fail_bus; + goto fail_brcmf; } ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); if (ret < 0) { kfree(fwreq); - goto fail_bus; + goto fail_brcmf; } return 0; +fail_brcmf: + brcmf_free(&devinfo->pdev->dev); fail_bus: kfree(bus->msgbuf); kfree(bus); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 99987a7..59c2b2b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4541,6 +4541,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) brcmf_sdiod_intr_unregister(bus->sdiodev); brcmf_detach(bus->sdiodev->dev); + brcmf_free(bus->sdiodev->dev); cancel_work_sync(&bus->datawork); if (bus->brcmf_wq)