Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp243912pxx; Wed, 28 Oct 2020 03:56:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGIc3p9I5Dy9I0uIPxvQtCgDQ727G+VnbmKb4MR/ypxCagvBvLRKaHR/ybrm/gIZimnFYu X-Received: by 2002:a17:906:72cd:: with SMTP id m13mr7232613ejl.387.1603882608497; Wed, 28 Oct 2020 03:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603882608; cv=none; d=google.com; s=arc-20160816; b=N7AV5owCigQBAcQ0+oKwOtqihlcHr8xkYLDbZ3mpQwYl98D0fUWeJXD3W69h2tCiNa jFbfqeqslB33KIZfB2MGKjb6nF7hbtumznD5vNY9/XyrapREYbiT+78kSSAPhXrEMi2Z fjYS4+gl/YRuN6wQBM9DQ3lLJwzkw4gVP1mU9SOrH8qTGKI7zEDDKXoPXREavYubQldO eEB5Sb5vE6wUNDydyX3LF6qDGoaoZyFYFnQ37poZrGdzLtt6G+zUYi437yt+XyBFRBLD KKC9H4LsCUD/tPG4xx+J3YXb3Q1eXR5iRgVAnGzWAHdlyh9xmcUU6jrU7uPpvz+EImNt 9RNA== 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=QtvHI4OknedfccovaAfQGVgDNb/x+VBwuB2YPq6H6vo=; b=F1Ce+IaJQ/M6irWTdsi+n1kQeJgd9aGSBV8SJ65d3jLXPizxnZgyWykrEuh+hPcrW1 eSzJvZWhygkunWJiEz7nAqMF1IyG8X/oPZRWGiNpbYS13zvQ675dA58DTXkHMTmYCHTl tCPGU5xpX9YC+6dD/1VwQrqVPqEvMuPdskJD/zUiwAVFk80it6B4rhZDPU25lsF3Utwb 5nJoJK5A/mkuXcDAS80leLNpVr/VJcAkGPjyQadgOogSPc/OLstWi70YBt9f0R6yd8MN BgKXpEVbDbM77Ibwcm8nOQPWiil/CtrWhlGLWFrTDVNlrQdBGV4LQ1o2WFXwAv5T3vDQ B9KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zDfmZiRD; 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=fail (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 g8si3473416ejm.389.2020.10.28.03.56.26; Wed, 28 Oct 2020 03:56:48 -0700 (PDT) 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=@kernel.org header.s=default header.b=zDfmZiRD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1782261AbgJ0O45 (ORCPT + 99 others); Tue, 27 Oct 2020 10:56:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:45892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2899678AbgJ0Op7 (ORCPT ); Tue, 27 Oct 2020 10:45:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9302F206E5; Tue, 27 Oct 2020 14:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809958; bh=mTY9y3pxS8i08iT2C0dGcNyVykiKc/+2kfaNjS4clTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDfmZiRDxz1qOL/V96Ppqkk8EF39AjLvSfVWAjZbaiNuI2h2AUJWGR5uzN0Pe6ywO Tzytzng774LhsWfXxuCKbWktIunI5l3m8dwnh1EeiW8WFO4WP0OQqxFJeBigOMR4AF RMTZHgkidzYSMiMaqQrycjVeUFAuRmsD/DqqU6uI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keita Suzuki , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 378/408] brcmsmac: fix memory leak in wlc_phy_attach_lcnphy Date: Tue, 27 Oct 2020 14:55:16 +0100 Message-Id: <20201027135512.543275386@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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: Keita Suzuki [ Upstream commit f4443293d741d1776b86ed1dd8c4e4285d0775fc ] When wlc_phy_txpwr_srom_read_lcnphy fails in wlc_phy_attach_lcnphy, the allocated pi->u.pi_lcnphy is leaked, since struct brcms_phy will be freed in the caller function. Fix this by calling wlc_phy_detach_lcnphy in the error handler of wlc_phy_txpwr_srom_read_lcnphy before returning. Signed-off-by: Keita Suzuki Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200908121743.23108-1-keitasuzuki.park@sslab.ics.keio.ac.jp Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c index 7ef36234a25dc..66797dc5e90d5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c @@ -5065,8 +5065,10 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft; pi->pi_fptr.detach = wlc_phy_detach_lcnphy; - if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) + if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) { + kfree(pi->u.pi_lcnphy); return false; + } if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { if (pi_lcn->lcnphy_tempsense_option == 3) { -- 2.25.1