linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Thomas Pedersen <thomas@adapt-ip.com>,
	Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 5.6 47/49] mac80211: add ieee80211_is_any_nullfunc()
Date: Fri,  8 May 2020 14:36:04 +0200	[thread overview]
Message-ID: <20200508123049.347809511@linuxfoundation.org> (raw)
In-Reply-To: <20200508123042.775047422@linuxfoundation.org>

From: Thomas Pedersen <thomas@adapt-ip.com>

commit 30b2f0be23fb40e58d0ad2caf8702c2a44cda2e1 upstream.

commit 08a5bdde3812 ("mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED")
Fixed a bug where we failed to take into account a
nullfunc frame can be either non-QoS or QoS. It turns out
there is at least one more bug in
ieee80211_sta_tx_notify(), introduced in
commit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing"),
where we forgot to check for the QoS variant and so
assumed the QoS nullfunc frame never went out

Fix this by adding a helper ieee80211_is_any_nullfunc()
which consolidates the check for non-QoS and QoS nullfunc
frames. Replace existing compound conditionals and add a
couple more missing checks for QoS variant.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20200114055940.18502-3-thomas@adapt-ip.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/ieee80211.h |    9 +++++++++
 net/mac80211/mlme.c       |    2 +-
 net/mac80211/rx.c         |    8 +++-----
 net/mac80211/status.c     |    5 ++---
 net/mac80211/tx.c         |    2 +-
 5 files changed, 16 insertions(+), 10 deletions(-)

--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -620,6 +620,15 @@ static inline bool ieee80211_is_qos_null
 }
 
 /**
+ * ieee80211_is_any_nullfunc - check if frame is regular or QoS nullfunc frame
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline bool ieee80211_is_any_nullfunc(__le16 fc)
+{
+	return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
+}
+
+/**
  * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
  * @fc: frame control field in little-endian byteorder
  */
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2460,7 +2460,7 @@ void ieee80211_sta_tx_notify(struct ieee
 	if (!ieee80211_is_data(hdr->frame_control))
 	    return;
 
-	if (ieee80211_is_nullfunc(hdr->frame_control) &&
+	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
 	    sdata->u.mgd.probe_send_count > 0) {
 		if (ack)
 			ieee80211_sta_reset_conn_monitor(sdata);
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1450,8 +1450,7 @@ ieee80211_rx_h_check_dup(struct ieee8021
 		return RX_CONTINUE;
 
 	if (ieee80211_is_ctl(hdr->frame_control) ||
-	    ieee80211_is_nullfunc(hdr->frame_control) ||
-	    ieee80211_is_qos_nullfunc(hdr->frame_control) ||
+	    ieee80211_is_any_nullfunc(hdr->frame_control) ||
 	    is_multicast_ether_addr(hdr->addr1))
 		return RX_CONTINUE;
 
@@ -1838,8 +1837,7 @@ ieee80211_rx_h_sta_process(struct ieee80
 	 * Drop (qos-)data::nullfunc frames silently, since they
 	 * are used only to control station power saving mode.
 	 */
-	if (ieee80211_is_nullfunc(hdr->frame_control) ||
-	    ieee80211_is_qos_nullfunc(hdr->frame_control)) {
+	if (ieee80211_is_any_nullfunc(hdr->frame_control)) {
 		I802_DEBUG_INC(rx->local->rx_handlers_drop_nullfunc);
 
 		/*
@@ -2319,7 +2317,7 @@ static int ieee80211_drop_unencrypted(st
 
 	/* Drop unencrypted frames if key is set. */
 	if (unlikely(!ieee80211_has_protected(fc) &&
-		     !ieee80211_is_nullfunc(fc) &&
+		     !ieee80211_is_any_nullfunc(fc) &&
 		     ieee80211_is_data(fc) && rx->key))
 		return -EACCES;
 
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -643,8 +643,7 @@ static void ieee80211_report_ack_skb(str
 		rcu_read_lock();
 		sdata = ieee80211_sdata_from_skb(local, skb);
 		if (sdata) {
-			if (ieee80211_is_nullfunc(hdr->frame_control) ||
-			    ieee80211_is_qos_nullfunc(hdr->frame_control))
+			if (ieee80211_is_any_nullfunc(hdr->frame_control))
 				cfg80211_probe_status(sdata->dev, hdr->addr1,
 						      cookie, acked,
 						      info->status.ack_signal,
@@ -1056,7 +1055,7 @@ static void __ieee80211_tx_status(struct
 			I802_DEBUG_INC(local->dot11FailedCount);
 	}
 
-	if ((ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
+	if (ieee80211_is_any_nullfunc(fc) &&
 	    ieee80211_has_pm(fc) &&
 	    ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) &&
 	    !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -297,7 +297,7 @@ ieee80211_tx_h_check_assoc(struct ieee80
 	if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) &&
 	    test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) &&
 	    !ieee80211_is_probe_req(hdr->frame_control) &&
-	    !ieee80211_is_nullfunc(hdr->frame_control))
+	    !ieee80211_is_any_nullfunc(hdr->frame_control))
 		/*
 		 * When software scanning only nullfunc frames (to notify
 		 * the sleep state to the AP) and probe requests (for the



  parent reply	other threads:[~2020-05-08 12:56 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 12:35 [PATCH 5.6 00/49] 5.6.12-rc1 review Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 01/49] vhost: vsock: kick send_pkt worker once device is started Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 02/49] drm/bridge: analogix_dp: Split bind() into probe() and real bind() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 03/49] ASoC: topology: Add missing memory checks Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 04/49] ASoC: topology: Check return value of soc_tplg_create_tlv Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 05/49] ASoC: topology: Check return value of soc_tplg_*_create Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 06/49] ASoC: topology: Check soc_tplg_add_route return value Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 07/49] ASoC: topology: Check return value of pcm_new_ver Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 08/49] ASoC: topology: Check return value of soc_tplg_dai_config Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 09/49] SUNRPC/cache: Fix unsafe traverse caused double-free in cache_purge Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 10/49] selftests: vm: Do not override definition of ARCH Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 11/49] selftests: vm: Fix 64-bit test builds for powerpc64le Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 12/49] Revert "Kernel selftests: tpm2: check for tpm support" Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 13/49] selftests/ipc: Fix test failure seen after initial test run Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 14/49] drm/bridge: anx6345: set correct BPC for display_info of connector Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 15/49] scsi: sg: add sg_remove_request in sg_write Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 16/49] ASoC: sgtl5000: Fix VAG power-on handling Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 17/49] ASoC: topology: Fix endianness issue Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 18/49] usb: dwc3: gadget: Properly set maxpacket limit Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 19/49] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 20/49] ASoC: rsnd: Fix HDMI channel mapping for " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 21/49] ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 22/49] remoteproc: qcom_q6v5_mss: fix a bug in q6v5_probe() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 23/49] drm/amd/powerplay: fix resume failed as smu table initialize early exit Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 24/49] drm/amdgpu: Correctly initialize thermal controller for GPUs with Powerplay table v0 (e.g Hawaii) Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 25/49] wimax/i2400m: Fix potential urb refcnt leak Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 26/49] net: stmmac: fix enabling socfpgas ptp_ref_clock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 27/49] net: stmmac: Fix sub-second increment Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 28/49] ASoC: rsnd: Dont treat master SSI in multi SSI setup as parent Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 29/49] ASoC: rsnd: Fix "status check failed" spam for multi-SSI Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 30/49] cifs: protect updating server->dstaddr with a spinlock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 31/49] scripts/config: allow colons in option strings for sed Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 32/49] cifs: do not share tcons with DFS Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 33/49] tracing: Fix memory leaks in trace_events_hist.c Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 34/49] ftrace: Fix memory leak caused by not freeing entry in unregister_ftrace_direct() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 35/49] net: phy: bcm84881: clear settings on link down Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 36/49] lib/mpi: Fix building for powerpc with clang Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 37/49] mac80211: sta_info: Add lockdep condition for RCU list usage Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 38/49] net: bcmgenet: suppress warnings on failed Rx SKB allocations Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 39/49] net: systemport: " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 40/49] tools/runqslower: Ensure own vmlinux.h is picked up first Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 41/49] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 5.6 42/49] drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event Greg Kroah-Hartman
2020-05-08 12:36 ` [PATCH 5.6 43/49] ALSA: hda: Match both PCI ID and SSID for driver blacklist Greg Kroah-Hartman
2020-05-08 12:36 ` [PATCH 5.6 44/49] x86/kvm: fix a missing-prototypes "vmread_error" Greg Kroah-Hartman
2020-05-08 12:36 ` [PATCH 5.6 45/49] platform/x86: GPD pocket fan: Fix error message when temp-limits are out of range Greg Kroah-Hartman
2020-05-08 12:36 ` [PATCH 5.6 46/49] ACPI: PM: s2idle: Fix comment in acpi_s2idle_prepare_late() Greg Kroah-Hartman
2020-05-08 12:36 ` Greg Kroah-Hartman [this message]
2020-05-08 12:36 ` [PATCH 5.6 48/49] cgroup, netclassid: remove double cond_resched Greg Kroah-Hartman
2020-05-08 12:36 ` [PATCH 5.6 49/49] mm/mremap: Add comment explaining the untagging behaviour of mremap() Greg Kroah-Hartman
2020-05-08 21:07 ` [PATCH 5.6 00/49] 5.6.12-rc1 review Guenter Roeck
2020-05-08 23:22 ` shuah
2020-05-09  7:45 ` Naresh Kamboju
2020-05-10  7:34   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508123049.347809511@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas@adapt-ip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).