Skip to content

Commit

Permalink
wifi: mac80211: fix check for unusable RX result
Browse files Browse the repository at this point in the history
If we just check "result & RX_DROP_UNUSABLE", this really only works
by accident, because SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE got to
have the value 1, and SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR is 2.

Fix this to really check the entire subsys mask for the value, so it
doesn't matter what the subsystem value is.

Fixes: 7f4e097 ("wifi: mac80211: report all unusable beacon frames")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Sep 26, 2023
1 parent e406f29 commit 5830585
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions net/mac80211/drop.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ enum mac80211_drop_reason {
#undef DEF
};

#define RX_RES_IS_UNUSABLE(result) \
(((__force u32)(result) & SKB_DROP_REASON_SUBSYS_MASK) == ___RX_DROP_UNUSABLE)

#endif /* MAC80211_DROP_H */
2 changes: 1 addition & 1 deletion net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
/* either the frame has been decrypted or will be dropped */
status->flag |= RX_FLAG_DECRYPTED;

if (unlikely(ieee80211_is_beacon(fc) && (result & RX_DROP_UNUSABLE) &&
if (unlikely(ieee80211_is_beacon(fc) && RX_RES_IS_UNUSABLE(result) &&
rx->sdata->dev))
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
skb->data, skb->len);
Expand Down

0 comments on commit 5830585

Please sign in to comment.