Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9131038pxu; Mon, 28 Dec 2020 07:22:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyw/VUuzYjWul7gpMvJ2j02dNhzRDpW23+ORy6yQ+CvTxnMN+lEEJD4iClpaOq7SSFlQeoy X-Received: by 2002:aa7:df0f:: with SMTP id c15mr43274374edy.354.1609168976515; Mon, 28 Dec 2020 07:22:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168976; cv=none; d=google.com; s=arc-20160816; b=Alzdy4kYRjw47Je664ls3jr7DFpUov0J4ssnQ60ADZHrX94wvSaY1b+aIh5whb0Onb cxGpfzgDWUF5HhyGjAAJ3UTlUvvhTtFma55F6JvFIIce2WaRvrh9qFVGXBBc1+hWFZrR 7ytMgcF9fkEruCh6S057rvfgRUPrhpA8vh3D1K7YHo6cYEbrW/75Z3hL6jnGFz97I5ZI YjZ9ac41jnqUDduREeGRbBwi4eyohh+sLKrgspqFcKfBWXs5omIlahO/J939k1FFbAHU o8c5liKGSxu7j7/lQlU3zgsA2hty7e4tK9TQ8hEi2jmnap4QVxsbCtRp2K+x+BWRnlcq SHgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HaytiW2s96VPFfJ9ih99u1BcgRnCmn9ntW4bDD7aFwE=; b=HEK6LdKYk2bVmmMP2suR73LSlm3hMEoikjtloGolONcDtV0LyBf3KyjbbloYVxk1r5 PcAoYzh2Uo88EVEp/5NrJ+taRTskLWJ5b13dKDGhvXlSi9pPyGpJmcMMt8lyUThiVdFc C0fv11Auj6h+misQ4NMrjTFOXa4Ee6wFMy70W+Ll/BJOcFXTLjYHozqwmfAK7aB8O0sT 58xmoeJX72LLpEH8z1AiSkWny3s6TiyB6YcGzrHIPfmqyFCO84Mlj8TfPFfbqTuwHbOe 7SPbPcaXR4laFx6QDo2NHLkqz1keOf/TomkBebUZMZP7ubwF3NFqcYoLtD0/B2LRLCSd Qqjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQIQCWw6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si19628024edu.11.2020.12.28.07.22.32; Mon, 28 Dec 2020 07:22:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQIQCWw6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436991AbgL1OCr (ORCPT + 99 others); Mon, 28 Dec 2020 09:02:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:36430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436953AbgL1OCn (ORCPT ); Mon, 28 Dec 2020 09:02:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1869C206D4; Mon, 28 Dec 2020 14:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164122; bh=4MGHoEv84Ba7fJbw5MLd8o0IbZKXfUu6u+TPGm3kb1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQIQCWw6bgctzAEY3WFdsiWhR1+3OYVaOFa5xd2BhNlAvRAfKGPokE3KADGg1e2e1 PjMxOv6+UHGCezAEERFxT8fsNc9qdDRwMKa8VvbWnGDhTn8XnALjHzn7S2zX8xZi3r Henwz3Kp+7hWmUAdtiev/ykcXKX6z7Z+8Q9LajPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaehoon Chung , Seung-Woo Kim , Arend van Spriel , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 068/717] brcmfmac: Fix memory leak for unpaired brcmf_{alloc/free} Date: Mon, 28 Dec 2020 13:41:06 +0100 Message-Id: <20201228125024.254098971@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Seung-Woo Kim [ Upstream commit 9db946284e07bb27309dd546b7fee528664ba82a ] There are missig brcmf_free() for brcmf_alloc(). Fix memory leak by adding missed brcmf_free(). Reported-by: Jaehoon Chung Fixes: a1f5aac1765a ("brcmfmac: don't realloc wiphy during PCIe reset") Signed-off-by: Seung-Woo Kim Reviewed-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1603849967-22817-1-git-send-email-sw0312.kim@samsung.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++-- drivers/net/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 39381cbde89e6..d8db0dbcfe091 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1936,16 +1936,18 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) 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 99987a789e7e3..59c2b2b6027da 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) -- 2.27.0