From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF3C1412294; Fri, 4 Sep 2026 05:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788500176; cv=none; b=n/dN2cSb/OcAk1bs/LWrG/ja1ulXdBiGe2aHaxevypIA5wAf2Dy+tDzjUV2J+e/5RkAYdPNCZ9EHFaTGy7RjlouKgnjuZd+Rw2JNn6okzm7memsUHu1VzpvDjXzqmaSU6FEkubF5y7scA4dekHRAyODoDpXZbXtaJCnLrIi4YXQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788500176; c=relaxed/simple; bh=uHcWemh4d/qW2icPJQiv6Dyv7SlzBYIMWTfR71LoZ2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZRYPTOmfFfo248ODLlA+Q7sOgHndEx23Fpd9oPGujcktf8mpuWE5OCQr9MoZFsAIh4enqVgaMJDu8eADMFBLQYqDn7ZMB0VEqfgtflgSRQAMh7pqQ23zoR8HEY6JPt06+Er2mok0hadCd9bSJeqovzMsfDCip6jmNXdtwcavWjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zCgHkTeE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zCgHkTeE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4401B1F00A3D; Fri, 4 Sep 2026 05:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788500174; bh=wQmHfWuZXWeWI2WCpqK6hEVNSfwVor9oQnSeTFGmCJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zCgHkTeEjotwpFREvLXJlw/xSGUaC8up5ABT890U+DunVpUedLSt8I57I/Ph/H79+ 9EQeDqFcvvms2iFzl1o4C17kwTQpwWlGNYudtk2sSmiL9Ha976XscdHgcQXPr/NEq+ rTpmvyZWYRUusfrTsP1ENUXsEqEB91W9mJgjTWCk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Arend van Spriel , Johannes Berg Subject: [PATCH 7.2 675/713] wifi: brcmfmac: Fix memory leak in brcmf_sdio_read_control() Date: Fri, 4 Sep 2026 07:00:43 +0200 Message-ID: <20260904045818.966299687@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045803.810145556@linuxfoundation.org> References: <20260904045803.810145556@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal commit 0d10db8e94fcb23a799789aaa696b4d8f937e207 upstream. The memory allocated for buf is not freed in some of the error paths in brcmf_sdio_read_control(). Fix that by adding vfree() calls. Cc: stable@vger.kernel.org Fixes: dd43a01c5cdb ("brcmfmac: use dynamically allocated control frame buffer") Signed-off-by: Abdun Nihaal [arend: rework as suggested by Johannes] Signed-off-by: Arend van Spriel Link: https://patch.msgid.link/20260803093506.1647790-1-arend.vanspriel@broadcom.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -1827,17 +1827,18 @@ gotpkt: if (bus->rxctl) { brcmf_err("last control frame is being processed.\n"); spin_unlock_bh(&bus->rxctl_lock); - vfree(buf); goto done; } bus->rxctl = buf + doff; bus->rxctl_orig = buf; bus->rxlen = len - doff; spin_unlock_bh(&bus->rxctl_lock); + buf = NULL; done: /* Awake any waiters */ brcmf_sdio_dcmd_resp_wake(bus); + vfree(buf); } /* Pad read to blocksize for efficiency */