Subject: Re: [PATCH] wifi: Check if socket flags are valid

From: Johannes Berg <[email-masked]>
Date: Tue, 20 May 2025 15:22:01 +0200

Hi Bert,

Thank you _very_ much for doing all this debug. I was somewhat following
along on my phone, but was out over the weekend.

> +++ b/drivers/net/wireless/ath/wil6210/txrx.h
> @@ -618,7 +618,7 @@ static inline bool wil_need_txstat(struct sk_buff *skb)
>  	const u8 *da = wil_skb_get_da(skb);
>  
>  	return is_unicast_ether_addr(da) && skb->sk &&
> -	       sock_flag(skb->sk, SOCK_WIFI_STATUS);
> +	       sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_WIFI_STATUS);

I feel like in line with sk_is_refcounted(), maybe we could add

static inline bool
sk_requests_wifi_status(struct sock *sk)
{
	return sk && sk_fullsock(sk) && sock_flag(sk,
SOCK_WIFI_STATUS);
}

perhaps?

That's basically all the checks in all the callers.

I can also just do that though if you don't want to resend.

johannes