Skip to content

Commit ef3a62d

Browse files
jmbergdavem330
authored andcommitted
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: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6d1a3fb commit ef3a62d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/mac80211/tx.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
11321132
ieee80211_tx_handler *handler;
11331133
struct ieee80211_tx_data tx;
11341134
ieee80211_tx_result res = TX_DROP, res_prepare;
1135-
int ret, i;
1135+
int ret, i, retries = 0;
11361136

11371137
WARN_ON(__ieee80211_queue_pending(local, control->queue));
11381138

@@ -1216,6 +1216,13 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
12161216
if (!__ieee80211_queue_stopped(local, control->queue)) {
12171217
clear_bit(IEEE80211_LINK_STATE_PENDING,
12181218
&local->state[control->queue]);
1219+
retries++;
1220+
/*
1221+
* Driver bug, it's rejecting packets but
1222+
* not stopping queues.
1223+
*/
1224+
if (WARN_ON_ONCE(retries > 5))
1225+
goto drop;
12191226
goto retry;
12201227
}
12211228
memcpy(&store->control, control,

0 commit comments

Comments
 (0)