Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1490573rwb; Thu, 1 Dec 2022 18:54:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6oSMM8X7Td0oLYyu8O1qLMh7IZ5SCC/erXnrjJ+lMULeiOy68nuTlzpfxpbslg15UxDHS8 X-Received: by 2002:a17:902:c206:b0:189:9b3c:eb99 with SMTP id 6-20020a170902c20600b001899b3ceb99mr16972766pll.146.1669949663290; Thu, 01 Dec 2022 18:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669949663; cv=none; d=google.com; s=arc-20160816; b=EUjrfKkziRuNh5u+0h5OQ0K7/pRSwH49qxYTDuNJ+AWarFuJbZbYVEVWHFD+xdRR+l MjPT3AYsBXvHL2zc777lUDOUUxLirSeCIU/iEjTQOE/kjtdRabnt2gNh4rshN+xYyCi+ +1/UhYoXzzegfthyKydoZIRZQLuJ8dNm/gBnTjdsWYo89dfUhsaSFShXxHRKQc7odkuf lyjfsgRdBtD06060TbZGtQ6d+okhDR7WNzQfqNUqwQOfPd741M1yDbCiXpFqoDaHsw+g RihSBXEdH9HZhVtmddRB6TA5HuF6TgbkFMF0fq+Zvqfi+l0jwCRBhQvPGWGvSL8KbVLs VzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=LocstKlb4Qy5Q2dZYDqz9YQf/uA8NMrWKr/S/Uhn8yk=; b=zNv77XQxH25XBifq7asHJRlmzpu6szpPv21cZ9l1rZKeJahYy2+b948FtnbnbhSNst VfIL4p8I2WZImxKnzMmRG7RjzZLIXX9KQRowS5F0Ywny5+BpNYJ933Zal9ri2U86xSbw gch5kUAklT1RLzF+IkTwwHTLylWrgiv4wTkxXNNYUbpI0J0EkA7vMS+HBAD7uk4IqHY+ rTO1ZY1v3G1K/tPAFHSZs4LgAn0ra/4eFmBLMtZkjl8MNiLwCmcJpgPvhluopFf0k0TC rnug6nqBpqWnzsBhuhTgkaQmlH1peM/kSv36VeoZMC8OA+zSrwdZ8xSXuTUarHHB45fT 2lag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a17090274cb00b0017840d9d42esi5591009plt.582.2022.12.01.18.54.10; Thu, 01 Dec 2022 18:54:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231902AbiLBCsS (ORCPT + 66 others); Thu, 1 Dec 2022 21:48:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbiLBCsQ (ORCPT ); Thu, 1 Dec 2022 21:48:16 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EE1089AE7; Thu, 1 Dec 2022 18:48:15 -0800 (PST) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NNcmf6VVtzRpk2; Fri, 2 Dec 2022 10:47:30 +0800 (CST) Received: from [10.174.178.66] (10.174.178.66) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 2 Dec 2022 10:48:13 +0800 Message-ID: <84669e9c-81f7-3a56-ea57-39df3e131b3f@huawei.com> Date: Fri, 2 Dec 2022 10:48:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Subject: Re: [PATCH] wifi: mac80211: fix memory leak in ieee80211_register_hw() To: Johannes Berg , , , , , , CC: , , , References: <20221122091142.261354-1-shaozhengchao@huawei.com> <4f37f422a0bcd8d1d2dd1bb992be30a16d335a3f.camel@sipsolutions.net> From: shaozhengchao In-Reply-To: <4f37f422a0bcd8d1d2dd1bb992be30a16d335a3f.camel@sipsolutions.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.66] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2022/12/1 20:52, Johannes Berg wrote: > On Tue, 2022-11-22 at 17:11 +0800, Zhengchao Shao wrote: >> >> +++ b/net/mac80211/iface.c >> @@ -2326,8 +2326,6 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) >> WARN(local->open_count, "%s: open count remains %d\n", >> wiphy_name(local->hw.wiphy), local->open_count); >> >> - ieee80211_txq_teardown_flows(local); > > > This is after shutting down interfaces. > >> @@ -1469,6 +1470,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) >> * because the driver cannot be handing us frames any >> * more and the tasklet is killed. >> */ >> + ieee80211_txq_teardown_flows(local); >> ieee80211_remove_interfaces(local); >> > > But now it's before. Why is that safe? > > johannes Hi johannes: Thank you for your review. This change may be unsafe. Driver do clear its reource must be after hardware stop. Remove it before shutdown interface is unsafe. I will change in V2. Zhengchao Shao