From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E00F9C46467 for ; Mon, 16 Jan 2023 16:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233213AbjAPQ2L (ORCPT ); Mon, 16 Jan 2023 11:28:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbjAPQ1v (ORCPT ); Mon, 16 Jan 2023 11:27:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33AFA2CC40 for ; Mon, 16 Jan 2023 08:16:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9AC92B8105D for ; Mon, 16 Jan 2023 16:16:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F39A8C433D2; Mon, 16 Jan 2023 16:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673885764; bh=gjNUSRhg0iJJIx7nPHtwAej4XhdLjfUNsg8yyPt0Sh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W59xl/fMEeLnqtCx55bJo/yijHAc82SLtHD503eMoiNSqfP5CmdXRKcpZoesdnIW5 w7JF2KPARwlXHc6Jpvh6BTnTZPYmqlMDF70xK9BRL+JOc7HBtw2XmWWVdbOaCXo1yU 4e8bPVZnhwpf7BtI06mFQaYMK7K3sDt9CquyK3kU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhengchao Shao , Johannes Berg , Sasha Levin Subject: [PATCH 5.4 175/658] wifi: mac80211: fix memory leak in ieee80211_if_add() Date: Mon, 16 Jan 2023 16:44:23 +0100 Message-Id: <20230116154917.473134649@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154909.645460653@linuxfoundation.org> References: <20230116154909.645460653@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhengchao Shao [ Upstream commit 13e5afd3d773c6fc6ca2b89027befaaaa1ea7293 ] When register_netdevice() failed in ieee80211_if_add(), ndev->tstats isn't released. Fix it. Fixes: 5a490510ba5f ("mac80211: use per-CPU TX/RX statistics") Signed-off-by: Zhengchao Shao Link: https://lore.kernel.org/r/20221117064500.319983-1-shaozhengchao@huawei.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/iface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index ddc001ad9055..cb06439e087c 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1888,6 +1888,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ret = register_netdevice(ndev); if (ret) { + ieee80211_if_free(ndev); free_netdev(ndev); return ret; } -- 2.35.1