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 1133E44AB9F; Tue, 21 Jul 2026 22:54:45 +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=1784674486; cv=none; b=VRjg95VriRVXfI3O8U+knvG8s+056aNeWYHEi5AvaCPsRwrY6SyYSJBR9qwNisFxvftOD/lxsKGIqcpm0/87ML4jonF3Dvr6deMfe8mU7V5x7eTrkufSs3B+C+0MEotju9JuRg191g4wW6wlAlrYlsfeiBWSP8FJZz0NO9XuLiU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674486; c=relaxed/simple; bh=TMrzWCsVACgzuOkD4Pdl11VjLt806lxXTzodJktGKpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tS9WfxCeLq0K7vMldmBkwZr8AeiUF+Ry6mQtb4Ae3Q3Gfln6o2/OSoXVZK0xDe0wM+rFjhK4B2p/7/BAtFMRm1yN+o13Eqiu2EiTJ60xi7ZBm8haPLEINgF5Q88o85cvUhaj+pw3iBQbD7hup2NEk0nu14AP/vdkMR9aABGU8Vw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p0/DWFUR; 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="p0/DWFUR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71EE41F000E9; Tue, 21 Jul 2026 22:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674485; bh=215/2i7em+c66SliEcICmn9+KaSYBrBp8oK4fKWIqL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=p0/DWFURXR0kCdqkVJHd4lhr265Z3yIbGd7md5Y1v1vfGRUD3oHNbBJCpwV9mZ+By WBkE0faPuuha9ZqJ985gumdaU5TiZXLSYq2uCBnMjKIchMc9Cq8K7y0P1hW6mbIovq 5xp+UnoxULVOMZpW/7pXQTQHPgUileh5sqREkSUw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Dawei Feng , Johannes Berg Subject: [PATCH 5.10 560/699] wifi: mac80211: fix memory leak in ieee80211_register_hw() Date: Tue, 21 Jul 2026 17:25:19 +0200 Message-ID: <20260721152408.342547529@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dawei Feng commit 95fc02722edde02946d0d475221f2b2054d3d8ba upstream. If kmemdup() fails while copying supported band structures, the error path jumps to fail_rate. This skips rate_control_deinitialize() and leaks the initialized local->rate_ctrl. Fix this by adding a fail_band label that shares the rate-control cleanup path before falling through to the remaining teardown. The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc7. An x86_64 allyesconfig build showed no new warnings. As we do not have a suitable mac80211 device/driver combination to test with, no runtime testing was able to be performed. Fixes: 09b4a4faf9d0 ("mac80211: introduce capability flags for VHT EXT NSS support") Cc: stable@vger.kernel.org Reviewed-by: Zilin Guan Signed-off-by: Dawei Feng Link: https://patch.msgid.link/20260706143507.146131-1-dawei.feng@seu.edu.cn Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1279,7 +1279,7 @@ int ieee80211_register_hw(struct ieee802 sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL); if (!sband) { result = -ENOMEM; - goto fail_rate; + goto fail_band; } wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n", @@ -1342,6 +1342,7 @@ int ieee80211_register_hw(struct ieee802 #endif wiphy_unregister(local->hw.wiphy); fail_wiphy_register: + fail_band: rtnl_lock(); rate_control_deinitialize(local); ieee80211_remove_interfaces(local);