All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: Drop the packets whose source or destination mac address is empty
@ 2019-11-13 23:55 Ming Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Ming Chen @ 2019-11-13 23:55 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Ming Chen

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.
---
 net/mac80211/tx.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index db38be1b75fa..0668123e8e85 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2481,6 +2481,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
 	bool tdls_peer;
 	bool multicast;
 	u16 info_id = 0;
+	const int empty_mac[ETH_ALEN] = {0};
 	struct ieee80211_chanctx_conf *chanctx_conf;
 	struct ieee80211_sub_if_data *ap_sdata;
 	enum nl80211_band band;
@@ -2489,6 +2490,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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
+	    !memcmp(skb->data + ETH_ALEN, empty_mac, ETH_ALEN)) {
+		ret = -ENOTCONN;
+		goto free;
+	}
+
 #ifdef CONFIG_MAC80211_DEBUGFS
 	if (local->force_tx_status)
 		info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -3414,6 +3422,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_local *local = sdata->local;
 	u16 ethertype = (skb->data[12] << 8) | skb->data[13];
 	int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
+	const int empty_mac[ETH_ALEN] = {0};
 	int hw_headroom = sdata->local->hw.extra_tx_headroom;
 	struct ethhdr eth;
 	struct ieee80211_tx_info *info;
@@ -3435,6 +3444,12 @@ 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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
+	    !memcmp(skb->data + ETH_ALEN, empty_mac, 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]);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] mac80211: Drop the packets whose source or destination mac address is empty
  2019-11-14  9:02 ` Kalle Valo
@ 2019-11-14 20:16   ` Ming Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Ming Chen @ 2019-11-14 20:16 UTC (permalink / raw)
  To: Kalle Valo, Ming Chen; +Cc: Johannes Berg, linux-wireless

Hello Kalle,

Thanks for your review. I just sent a V2 patch. Please help me review it again. 


Ming 

-----Original Message-----
From: Kalle Valo <kvalo@codeaurora.org> 
Sent: Thursday, November 14, 2019 1:02 AM
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] 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.

s-o-b missing, please read:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing

> ---
>  net/mac80211/tx.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 
> db38be1b75fa..0668123e8e85 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -2481,6 +2481,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
>  	bool tdls_peer;
>  	bool multicast;
>  	u16 info_id = 0;
> +	const int empty_mac[ETH_ALEN] = {0};
>  	struct ieee80211_chanctx_conf *chanctx_conf;
>  	struct ieee80211_sub_if_data *ap_sdata;
>  	enum nl80211_band band;
> @@ -2489,6 +2490,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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
> +	    !memcmp(skb->data + ETH_ALEN, empty_mac, ETH_ALEN)) {
> +		ret = -ENOTCONN;
> +		goto free;
> +	}

Can you use is_zero_ether_addr()?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Drop the packets whose source or destination mac address is empty
  2019-11-14  0:12 Ming Chen
@ 2019-11-14  9:02 ` Kalle Valo
  2019-11-14 20:16   ` Ming Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2019-11-14  9:02 UTC (permalink / raw)
  To: Ming Chen; +Cc: Johannes Berg, linux-wireless, Ming Chen

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.

s-o-b missing, please read:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing

> ---
>  net/mac80211/tx.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index db38be1b75fa..0668123e8e85 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -2481,6 +2481,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
>  	bool tdls_peer;
>  	bool multicast;
>  	u16 info_id = 0;
> +	const int empty_mac[ETH_ALEN] = {0};
>  	struct ieee80211_chanctx_conf *chanctx_conf;
>  	struct ieee80211_sub_if_data *ap_sdata;
>  	enum nl80211_band band;
> @@ -2489,6 +2490,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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
> +	    !memcmp(skb->data + ETH_ALEN, empty_mac, ETH_ALEN)) {
> +		ret = -ENOTCONN;
> +		goto free;
> +	}

Can you use is_zero_ether_addr()?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mac80211: Drop the packets whose source or destination mac address is empty
@ 2019-11-14  0:12 Ming Chen
  2019-11-14  9:02 ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Chen @ 2019-11-14  0:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Ming Chen

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.
---
 net/mac80211/tx.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index db38be1b75fa..0668123e8e85 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2481,6 +2481,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
 	bool tdls_peer;
 	bool multicast;
 	u16 info_id = 0;
+	const int empty_mac[ETH_ALEN] = {0};
 	struct ieee80211_chanctx_conf *chanctx_conf;
 	struct ieee80211_sub_if_data *ap_sdata;
 	enum nl80211_band band;
@@ -2489,6 +2490,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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
+	    !memcmp(skb->data + ETH_ALEN, empty_mac, ETH_ALEN)) {
+		ret = -ENOTCONN;
+		goto free;
+	}
+
 #ifdef CONFIG_MAC80211_DEBUGFS
 	if (local->force_tx_status)
 		info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -3414,6 +3422,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_local *local = sdata->local;
 	u16 ethertype = (skb->data[12] << 8) | skb->data[13];
 	int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
+	const int empty_mac[ETH_ALEN] = {0};
 	int hw_headroom = sdata->local->hw.extra_tx_headroom;
 	struct ethhdr eth;
 	struct ieee80211_tx_info *info;
@@ -3435,6 +3444,12 @@ 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 (!memcmp(skb->data, empty_mac, ETH_ALEN) ||
+	    !memcmp(skb->data + ETH_ALEN, empty_mac, 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]);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-14 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 23:55 [PATCH] mac80211: Drop the packets whose source or destination mac address is empty Ming Chen
2019-11-14  0:12 Ming Chen
2019-11-14  9:02 ` Kalle Valo
2019-11-14 20:16   ` Ming Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.