diff mbox series

[v2] mac80211: Drop the packets whose source or destination mac address is empty

Message ID 20191114195712.101568-1-ming.chen@watchguard.com (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series [v2] mac80211: Drop the packets whose source or destination mac address is empty | expand

Commit Message

Ming Chen Nov. 14, 2019, 7:57 p.m. UTC
We occasionally found ath9k could receive some packets from Linux IP stack
with empty source and destination mac address,which will result in the
driver cannot find the station node in TX complete. And thus, the driver
will complete this buffer but without updating the block ack window.

To fix this issue, we should drop this kind of error packet before it
goes into the driver.
---

According to review feedback, use the is_zero_ether_addr to check if the
mac address is empty.

Signed-off-by: Ming Chen <ming.chen@watchguard.com>
---
 net/mac80211/tx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Kalle Valo Nov. 15, 2019, 7:15 a.m. UTC | #1
Ming Chen <ming032217@gmail.com> writes:

> We occasionally found ath9k could receive some packets from Linux IP stack
> with empty source and destination mac address,which will result in the
> driver cannot find the station node in TX complete. And thus, the driver
> will complete this buffer but without updating the block ack window.
>
> To fix this issue, we should drop this kind of error packet before it
> goes into the driver.

The s-o-b line should be here, before the "---" line.

> ---
>
> According to review feedback, use the is_zero_ether_addr to check if the
> mac address is empty.

Very good that you added the changelog, but to make it more obvious you
could, for example, mark the changelog like this:

---

v3:

Fix s-o-b location

v2:

According to review feedback, use the is_zero_ether_addr to check if the
mac address is empty.
Ming Chen Nov. 15, 2019, 8:05 a.m. UTC | #2
Thanks for your careful review, Kalle.

I updated v3 with regards to your comments.


Ming

-----Original Message-----
From: Kalle Valo <kvalo@codeaurora.org> 
Sent: Thursday, November 14, 2019 11:16 PM
To: Ming Chen <ming032217@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>; linux-wireless@vger.kernel.org; Ming Chen <Ming.Chen@watchguard.com>
Subject: Re: [PATCH v2] mac80211: Drop the packets whose source or destination mac address is empty

Ming Chen <ming032217@gmail.com> writes:

> We occasionally found ath9k could receive some packets from Linux IP 
> stack with empty source and destination mac address,which will result 
> in the driver cannot find the station node in TX complete. And thus, 
> the driver will complete this buffer but without updating the block ack window.
>
> To fix this issue, we should drop this kind of error packet before it 
> goes into the driver.

The s-o-b line should be here, before the "---" line.

> ---
>
> According to review feedback, use the is_zero_ether_addr to check if 
> the mac address is empty.

Very good that you added the changelog, but to make it more obvious you could, for example, mark the changelog like this:

---

v3:

Fix s-o-b location

v2:

According to review feedback, use the is_zero_ether_addr to check if the mac address is empty.

--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
diff mbox series

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index db38be1b75fa..b18745a3f6b0 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2489,6 +2489,13 @@  static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
 	if (IS_ERR(sta))
 		sta = NULL;
 
+	/* drop this skb when source mac or destination mac is empty */
+	if (is_zero_ether_addr(skb->data) ||
+	    is_zero_ether_addr(skb->data + ETH_ALEN)) {
+		ret = -ENOTCONN;
+		goto free;
+	}
+
 #ifdef CONFIG_MAC80211_DEBUGFS
 	if (local->force_tx_status)
 		info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -3435,6 +3442,11 @@  static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
 	if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)
 		return false;
 
+	/* drop this skb when source mac or destination mac is empty */
+	if (is_zero_ether_addr(skb->data) ||
+	    is_zero_ether_addr(skb->data + ETH_ALEN))
+		return false;
+
 	if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
 		tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
 		tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);