Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp776367rwn; Thu, 15 Sep 2022 06:24:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7+vg6F0wMQK7RtR+TMX3pJy1fstqjnlfpx3ybYB7WUf0+OfxKFGxuLUgb4CTFnKrbVLrlS X-Received: by 2002:a17:907:75c1:b0:730:aa62:7f65 with SMTP id jl1-20020a17090775c100b00730aa627f65mr28555833ejc.355.1663248249248; Thu, 15 Sep 2022 06:24:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663248249; cv=none; d=google.com; s=arc-20160816; b=Q4uuCfC/q/nww6el2xo5oJfHrF4zF5iEEWpUv7uWYtcTlFy2uo+WbNfJ/8gvhyiDhv U9D13NShkJffgZALm7sUkRoQS+CFBJZpNEPHeZgcOu8ebEUkcyCyMBsho0+ZNubyJJoi Wq3aiY+nFnEy9Xf5B6k0c4sKVQFhXHojP2Zbwx+LHfOHULVFn6MbT6NR+fxy6xgVo6US S34PPR0kMjlnZuVkZLHXLUfrKGP6DKjizNCXIWnetthumY7Yow0LfM+y6xwJSNbC/2Fs uZowte1F/Z/1DgB7hsABlVJG6Xak9yGI7dVGEx8Ie1/isMCBIEDcP+FhJh6u3TEFN27a Em+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=1O3G7/8Oug9lyRbDonsMa5me1ToO9t9WZjOhN9ZtdKA=; b=NiFZ2IfrcRwCmybDVZsdLrTcXsg+JdDeCgBRcm3ZJjE1iGHQhrw0ZwloC/Vgx99E6C rUnlHKVK1Enh/D4eqsiSeCJWRIwc6EhTWuZ08AI1ScOMIF61QYJmi/1IacAZXL9FD1T4 tdRPtAVvUjBLroOCLwWKnXv6D4aZMnME0+DBmEJXUcPA74aNPux4N8w0q685iPGO037F L2sNIUoOmFHyE8Ov77R+SCZ6XLezNH4nM+H+32mCohgTz1AGDs6b1CbucXUMYaye618I /jf9oN/KvGAraEo4BD8wnOOxs5vwfXhv2dQ2aI/Nd8iG+mP5WUzhhoeodub/Tobh32qw qUZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=gzABjwsw; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn24-20020a1709070d1800b0077b36470c3csi13538942ejc.74.2022.09.15.06.23.47; Thu, 15 Sep 2022 06:24:09 -0700 (PDT) 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; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=gzABjwsw; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbiIONLV (ORCPT + 64 others); Thu, 15 Sep 2022 09:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiIONLT (ORCPT ); Thu, 15 Sep 2022 09:11:19 -0400 Received: from ns2.wdyn.eu (ns2.wdyn.eu [5.252.227.236]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 545F7371AF for ; Thu, 15 Sep 2022 06:11:18 -0700 (PDT) From: Alexander Wetzel DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wetzel-home.de; s=wetzel-home; t=1663247476; bh=48tDIj0A9GvYAtg3Z0lO5EOHGEAhb+Ky2FLtbtQEnyw=; h=From:To:Cc:Subject:Date; b=gzABjwsw0zaNDSDnEI2d+B+BN4kfzn+AiuNUlR9g32bmjGoh3uhohxO64Ioddd7EV nnuuVMIUEnfzRr/JRiYPYtsn7lPmzZpRzJLUOIrrzFngyQLFua6O0Crdc0ISUsN3Ii wTCrCLOrsRwwX00k+Ysw8JyqyGKrTaWs4+4RWMjg= To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Felix Fietkau , Alexander Wetzel , stable@vger.kernel.org Subject: [PATCH] mac80211: Ensure vif queues are operational after start Date: Thu, 15 Sep 2022 15:09:46 +0200 Message-Id: <20220915130946.302803-1-alexander@wetzel-home.de> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Make sure local->queue_stop_reasons and vif.txqs_stopped stay in sync. When a new vif is created the queues may end up in an inconsistent state and be inoperable: Communication not using iTXQ will work, allowing to e.g. complete the association. But the 4-way handshake will time out. The sta will not send out any skbs queued in iTXQs. All normal attempts to start the queues will fail when reaching this state. local->queue_stop_reasons will have marked all queues as operational but vif.txqs_stopped will still be set, creating an inconsistent internal state. In reality this seems to be race between the mac80211 function ieee80211_do_open() setting SDATA_STATE_RUNNING and the wake_txqs_tasklet: Depending on the driver and the timing the queues may end up to be operational or not. Cc: stable@vger.kernel.org Fixes: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped") Signed-off-by: Alexander Wetzel --- net/mac80211/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 0ea5d50091dc..bf7461c41bef 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -301,14 +301,14 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) local_bh_disable(); spin_lock(&fq->lock); + sdata->vif.txqs_stopped[ac] = false; + if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) goto out; if (sdata->vif.type == NL80211_IFTYPE_AP) ps = &sdata->bss->ps; - sdata->vif.txqs_stopped[ac] = false; - list_for_each_entry_rcu(sta, &local->sta_list, list) { if (sdata != sta->sdata) continue; -- 2.37.3