From patchwork Sun Jul 17 02:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 591639 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 B019CCCA479 for ; Sun, 17 Jul 2022 02:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiGQCdK (ORCPT ); Sat, 16 Jul 2022 22:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiGQCdK (ORCPT ); Sat, 16 Jul 2022 22:33:10 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBD5A186FC; Sat, 16 Jul 2022 19:33:06 -0700 (PDT) Received: from fsav113.sakura.ne.jp (fsav113.sakura.ne.jp [27.133.134.240]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 26H2WkRu030000; Sun, 17 Jul 2022 11:32:46 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav113.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav113.sakura.ne.jp); Sun, 17 Jul 2022 11:32:46 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav113.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 26H2Wep8029986 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sun, 17 Jul 2022 11:32:46 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <81f3eeda-0888-2869-659e-dc38c0a9debf@I-love.SAKURA.ne.jp> Date: Sun, 17 Jul 2022 11:32:38 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: [PATCH] wifi: mac80211: initialize fq.lock as early as possible Content-Language: en-US To: Johannes Berg , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Felix Fietkau References: <00000000000040bd4905e3c2c237@google.com> Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org From: Tetsuo Handa In-Reply-To: <00000000000040bd4905e3c2c237@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org lockdep complains use of uninitialized spinlock at ieee80211_do_stop() [1], for commit f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif that is being stopped") guards clear_bit() using fq.lock even before fq_init() from ieee80211_txq_setup_flows() initializes this spinlock. Initialize this spinlock as early as possible. Link: https://syzkaller.appspot.com/bug?extid=eceab52db7c4b961e9d6 [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif that is being stopped") Tested-by: syzbot --- net/mac80211/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 5a385d4146b9..584e98300bbf 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -642,6 +642,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, wiphy->bss_priv_size = sizeof(struct ieee80211_bss); local = wiphy_priv(wiphy); + spin_lock_init(&local->fq.lock); if (sta_info_init(local)) goto err_free;