diff options
author | 2025-05-21 00:34:29 +0200 | |
---|---|---|
committer | 2025-05-21 09:26:22 +0200 | |
commit | d7500fbfb12067ee7313f13f4c58f771be3018ab (patch) | |
tree | ad18cb4943e6c4da5c5a361f070856be131e3d1c /include | |
parent | wifi: mac80211: handle non-MLO mode as well in ieee80211_num_beaconing_links() (diff) | |
download | wireguard-linux-d7500fbfb12067ee7313f13f4c58f771be3018ab.tar.xz wireguard-linux-d7500fbfb12067ee7313f13f4c58f771be3018ab.zip |
wifi: check if socket flags are valid
Checking the SOCK_WIFI_STATUS flag bit in sk_flags may give wrong results
since sk_flags are part of a union and the union is used otherwise. Add
sk_requests_wifi_status() which checks if sk is non-NULL, sk is a full
socket (so flags are valid) and checks the flag bit.
Fixes: 76a853f86c97 ("wifi: free SKBTX_WIFI_STATUS skb tx_flags flag")
Suggested-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Bert Karwatzki <spasswolf@web.de>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Link: https://patch.msgid.link/20250520223430.6875-1-spasswolf@web.de
[edit commit message, fix indentation]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index f0fabb9fd28a..75c12e14fc47 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2821,6 +2821,12 @@ sk_is_refcounted(struct sock *sk) return !sk_fullsock(sk) || !sock_flag(sk, SOCK_RCU_FREE); } +static inline bool +sk_requests_wifi_status(struct sock *sk) +{ + return sk && sk_fullsock(sk) && sock_flag(sk, SOCK_WIFI_STATUS); +} + /* Checks if this SKB belongs to an HW offloaded socket * and whether any SW fallbacks are required based on dev. * Check decrypted mark in case skb_orphan() cleared socket. |