Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8168279ybn; Tue, 1 Oct 2019 04:22:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqykgZ1K39ODshtmZP8PKtC18S9o+jSMgr1xnsdXVZG/cUxoCYfBn8ypmxtAbKGj9JXY197n X-Received: by 2002:a17:906:1998:: with SMTP id g24mr22982036ejd.305.1569928921839; Tue, 01 Oct 2019 04:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569928921; cv=none; d=google.com; s=arc-20160816; b=KXtiE7dr4hmc6DkIRo+9n3feY9CE1c7vLK+UjbPAeuyvMxD3fjTFvuDEVQ8ilrsKxp cO3uBZqOG4DWICjyl71A8LoP97rq5iklWQ1dX7yxJkxoy3iJykrh6qWRUdUP0Ic8VTwc +DE41ruoWxWpeadHz26OWXjq+eO0pP7aVDVKVFM6CbX+7IKita+eWHlU3sSRqLtIxi+v vyqkDQ5pmhPFVelqTeMeO/LKTxXaU4cBbcgj6kUTDWLi59Xj9QBUy1pf7ROw+Xq0vN9l Uf0rZUgoJIVmHNfpgiGzywYbRhLYWpBjkjxGH2AjlglVnBu4QmEAoD1QV0Agr/tllBpt 7FiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=E81zSG86FstWGONM7lHxe8t43XQRzeSLtaefnZmL9s0=; b=H/k5XFdHQHD+598VzgnmeQtNylmK4w9Oy5po8TOL/CdAez1rtbZosfW92WcqiRW9Fv OVStMi/S7Ta2IBcckUILGNjzw0abJZEY2erYemXSMeu/MQGbKMdthET5XZnz5Xvjq8Nv Atzo9D6dm7zG3ZERz9bVH0o3JYfgVHQ9CMnKnyad4VdPcw0g9QwCp+SrWRLCeDuaqpip rjY/vtHnlnmVIUjiiCqwGjRRVwvlgmEeB5ANPDRlo7enpLj5cycM7OcXFX5vmb8zq3x0 rwgCmGvM7jrkXCy0dRW/L/P2G+4mOooGWryva5RhrPANMf0S7CkaGZY+dnOQi5veoQhc LovQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g32si9159431eda.330.2019.10.01.04.21.36; Tue, 01 Oct 2019 04:22:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731392AbfJALTc (ORCPT + 99 others); Tue, 1 Oct 2019 07:19:32 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:60168 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730379AbfJALTb (ORCPT ); Tue, 1 Oct 2019 07:19:31 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.2) (envelope-from ) id 1iFGBj-0006ZU-QK; Tue, 01 Oct 2019 13:19:27 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg , Jiri Kosina , Aaron Hill , Lukas Redlinger , Oleksii Shevchuk Subject: [PATCH v2] mac80211: keep BHs disabled while calling drv_tx_wake_queue() Date: Tue, 1 Oct 2019 13:19:23 +0200 Message-Id: <1569928763-I3e8838c5ecad878e59d4a94eb069a90f6641461a@changeid> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg Drivers typically expect this, as it's the case for almost all cases where this is called (i.e. from the TX path). Also, the code in mac80211 itself (if the driver calls ieee80211_tx_dequeue()) expects this as it uses this_cpu_ptr() without additional protection. This should fix various reports of the problem: https://bugzilla.kernel.org/show_bug.cgi?id=204127 https://lore.kernel.org/linux-wireless/CAN5HydrWb3o_FE6A1XDnP1E+xS66d5kiEuhHfiGKkLNQokx13Q@mail.gmail.com/ https://lore.kernel.org/lkml/nycvar.YFH.7.76.1909111238470.473@cbobk.fhfr.pm/ Reported-by: Jiri Kosina Reported-by: Aaron Hill Reported-by: Lukas Redlinger Reported-by: Oleksii Shevchuk Signed-off-by: Johannes Berg --- v2: * use local_bh_enable/disable to capture the last occurrence * split spin_lock_bh() into local_bh_disable()/spin_lock() to make it clearer while we unlock them separately --- net/mac80211/util.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 051a02ddcb85..32a7a53833c0 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -247,7 +247,8 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) struct sta_info *sta; int i; - spin_lock_bh(&fq->lock); + local_bh_disable(); + spin_lock(&fq->lock); if (sdata->vif.type == NL80211_IFTYPE_AP) ps = &sdata->bss->ps; @@ -273,9 +274,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) &txqi->flags)) continue; - spin_unlock_bh(&fq->lock); + spin_unlock(&fq->lock); drv_wake_tx_queue(local, txqi); - spin_lock_bh(&fq->lock); + spin_lock(&fq->lock); } } @@ -288,12 +289,14 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) goto out; - spin_unlock_bh(&fq->lock); + spin_unlock(&fq->lock); drv_wake_tx_queue(local, txqi); + local_bh_enable(); return; out: - spin_unlock_bh(&fq->lock); + spin_unlock(&fq->lock); + local_bh_enable(); } static void -- 2.20.1