Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2519250rwb; Mon, 3 Oct 2022 01:49:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76vVA6Zvnx8kpcL3LApbtcPX4txsSgzDkGnUZGxkl2NlO5CC5bHa4gXhEaKjucjhwPNpQ/ X-Received: by 2002:a17:90b:4b87:b0:202:d760:9b00 with SMTP id lr7-20020a17090b4b8700b00202d7609b00mr11114515pjb.194.1664786981686; Mon, 03 Oct 2022 01:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664786981; cv=none; d=google.com; s=arc-20160816; b=Oj45lYAszxbWbY4Rdl+HWe7bUuTkIUr8D13Y5KZ0gb28mOp6yssKBr3mnbD1eIcRtl AhilkIrryjDRz5sIZ1m4Is3ODAcMaIowEg49yI5YQbJrRrfJocdZmpGf9/OGD2uT5qUN 0wBHzMarbcIUllp0aN5uLqstzfG22Meq7yo7hVPD8jtgvmYa8PaidWZGxK1flHh0XhVJ NrenMeO28wfWMtPAdDlT/kFoFHd5XpdzK/uu4VYD/gifDMNkFoz5GHTn+EtGPA6wzMVD S9hnk7ya9T5MJ+T7BncGR3eDM/KNUgkWv/CoRFVa5capvCn3KNrKgQwpEwvviNsptfZr kZBw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zUelGZOPVbC687FpcZRkhxtF+aBj6wftYrol4y6M84c=; b=qmRD9+0P0PI5Np7gwKI2YnFg1rGvZFCdiqGo16WMr4gZauKEZcP+do7EujwCQbilMx pFcLQxbWhz5hpNefBeZolhvoLjBZh52C0u9Vf3V8NtC7vlg1DC+pxtqbc/CRg/addCdq To6C/ijMreUhkCpiADVQe/DUIbS2qGLUKPGLsRw3ReP7O5elVmnDDsnwaAamTwxb2aeQ 6oQgxV6Ekr5WkWPUPNgJ8aGZ75Nc4Nlj5gfEDXpNbscstiPW9fSxYYn5FFYojvn9nH/2 G1hm19rqnSG1FVNtEjG46NFo0hH4Nvo2mWEK3QrnXCjjNvI1If2WRAfKvQnPzqKf96hL iZfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zE5XH6Ol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020aa781c2000000b0053bafb8e916si8784107pfn.162.2022.10.03.01.49.30; Mon, 03 Oct 2022 01:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=zE5XH6Ol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbiJCHfr (ORCPT + 99 others); Mon, 3 Oct 2022 03:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbiJCHec (ORCPT ); Mon, 3 Oct 2022 03:34:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A0C52E5E; Mon, 3 Oct 2022 00:22:11 -0700 (PDT) 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 63261B80E68; Mon, 3 Oct 2022 07:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA9C1C433D6; Mon, 3 Oct 2022 07:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781618; bh=SXP9nyNk5NtHD1ho0EXPJBi6RxYXVxyFXz9k3y7vsU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zE5XH6OlMIWNJBbSlfeTQfb1HN7bNNmH5rYEKLn4jeSSpoPKEtjplOd8NhGnV22On x2BScNvD3Q3IiXZgT/lWkCG1EwSwNOsfZhS1MURzGRJ+heXntvpUaw76BUlhZxQKhP roOySSxw5cHPPDi4uwl7tCGTT2nsuswzW7248lyM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Theil , Stanislaw Gruszka , Hans de Goede , Johannes Berg , Sasha Levin Subject: [PATCH 5.15 61/83] wifi: mac80211: fix regression with non-QoS drivers Date: Mon, 3 Oct 2022 09:11:26 +0200 Message-Id: <20221003070723.529470949@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit d873697ef2b7e1b6fdd8e9d449d9354bd5d29a4a ] Commit 10cb8e617560 ("mac80211: enable QoS support for nl80211 ctrl port") changed ieee80211_tx_control_port() to aways call __ieee80211_select_queue() without checking local->hw.queues. __ieee80211_select_queue() returns a queue-id between 0 and 3, which means that now ieee80211_tx_control_port() may end up setting the queue-mapping for a skb to a value higher then local->hw.queues if local->hw.queues is less then 4. Specifically this is a problem for ralink rt2500-pci cards where local->hw.queues is 2. There this causes rt2x00queue_get_tx_queue() to return NULL and the following error to be logged: "ieee80211 phy0: rt2x00mac_tx: Error - Attempt to send packet over invalid queue 2", after which association with the AP fails. Other callers of __ieee80211_select_queue() skip calling it when local->hw.queues < IEEE80211_NUM_ACS, add the same check to ieee80211_tx_control_port(). This fixes ralink rt2500-pci and similar cards when less then 4 tx-queues no longer working. Fixes: 10cb8e617560 ("mac80211: enable QoS support for nl80211 ctrl port") Cc: Markus Theil Suggested-by: Stanislaw Gruszka Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220918192052.443529-1-hdegoede@redhat.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index a499b07fee33..8f8dc2625d53 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5719,6 +5719,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, skb_reset_network_header(skb); skb_reset_mac_header(skb); + if (local->hw.queues < IEEE80211_NUM_ACS) + goto start_xmit; + /* update QoS header to prioritize control port frames if possible, * priorization also happens for control port frames send over * AF_PACKET @@ -5734,6 +5737,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, rcu_read_unlock(); +start_xmit: /* mutex lock is only needed for incrementing the cookie counter */ mutex_lock(&local->mtx); -- 2.35.1