]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: mac80211: return error from control port TX for drops
authorJohannes Berg <johannes.berg@intel.com>
Tue, 19 Jul 2022 07:37:59 +0000 (09:37 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 22 Jul 2022 12:28:14 +0000 (14:28 +0200)
If the frame is going to be dropped anyway because
ieee80211_lookup_ra_sta() returned an error (and
even though it's a bit racy, it will likely continue
to do so), return the error out instead of just
silently dropping the frame.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c

index f246b3d264ee63958461e44da3054a90e59fcf14..772108c2cc6be271d8df145b5a96cba503e54c2c 100644 (file)
@@ -5712,6 +5712,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
        struct ethhdr *ehdr;
        u32 ctrl_flags = 0;
        u32 flags = 0;
+       int err;
 
        /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
         * or Pre-Authentication
@@ -5772,14 +5773,18 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
         * AF_PACKET
         */
        rcu_read_lock();
+       err = ieee80211_lookup_ra_sta(sdata, skb, &sta);
+       if (err) {
+               rcu_read_unlock();
+               return err;
+       }
 
-       if (ieee80211_lookup_ra_sta(sdata, skb, &sta) == 0 && !IS_ERR(sta)) {
+       if (!IS_ERR(sta)) {
                u16 queue = __ieee80211_select_queue(sdata, sta, skb);
 
                skb_set_queue_mapping(skb, queue);
                skb_get_hash(skb);
        }
-
        rcu_read_unlock();
 
        /* mutex lock is only needed for incrementing the cookie counter */