Commit ef3a62d2 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

mac80211: detect driver tx bugs

When a driver rejects a frame in it's ->tx() callback, it must also
stop queues, otherwise mac80211 can go into a loop here. Detect this
situation and abort the loop after five retries, warning about the
driver bug.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d1a3fb5
...@@ -1132,7 +1132,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, ...@@ -1132,7 +1132,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
ieee80211_tx_handler *handler; ieee80211_tx_handler *handler;
struct ieee80211_tx_data tx; struct ieee80211_tx_data tx;
ieee80211_tx_result res = TX_DROP, res_prepare; ieee80211_tx_result res = TX_DROP, res_prepare;
int ret, i; int ret, i, retries = 0;
WARN_ON(__ieee80211_queue_pending(local, control->queue)); WARN_ON(__ieee80211_queue_pending(local, control->queue));
...@@ -1216,6 +1216,13 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, ...@@ -1216,6 +1216,13 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
if (!__ieee80211_queue_stopped(local, control->queue)) { if (!__ieee80211_queue_stopped(local, control->queue)) {
clear_bit(IEEE80211_LINK_STATE_PENDING, clear_bit(IEEE80211_LINK_STATE_PENDING,
&local->state[control->queue]); &local->state[control->queue]);
retries++;
/*
* Driver bug, it's rejecting packets but
* not stopping queues.
*/
if (WARN_ON_ONCE(retries > 5))
goto drop;
goto retry; goto retry;
} }
memcpy(&store->control, control, memcpy(&store->control, control,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment