Re: [PATCH wireless-next v2 8/8] wifi: mac80211: pass error station if non-STA transmit was requested

Ramasamy Kaliappan <[email protected]> Thu, 6 Aug 2026 22:32:32 +0530
Newsgroups org.kernel.vger.linux-wireless
Message-ID <[email protected]>

On 8/3/2026 6:00 PM, Benjamin Berg wrote:
> From: Benjamin Berg <[email protected]>
> 
> When cfg80211 requested a transmit without a station, pass an error
> station to ieee80211_tx_skb_tid instead of the correct one.
> 
> Signed-off-by: Benjamin Berg <[email protected]>
> 
> ---
> 
> v1:
>   * Only pass error station if NO_STA flag is set
> ---
>   net/mac80211/offchannel.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
> index 5cec8747b193..653710576831 100644
> --- a/net/mac80211/offchannel.c
> +++ b/net/mac80211/offchannel.c
> @@ -854,8 +854,10 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
>   			need_offchan = true;
>   
>   		rcu_read_lock();
> -		sta = sta_info_get_bss(sdata, mgmt->da);
> -		mlo_sta = sta && sta->sta.mlo;
> +		if (!params->no_sta) {
> +			sta = sta_info_get_bss(sdata, mgmt->da);
> +			mlo_sta = sta && sta->sta.mlo;
> +		}
>   
>   		if (!ieee80211_is_action(mgmt->frame_control) ||
>   		    mgmt->u.action.category == WLAN_CATEGORY_PUBLIC ||
> @@ -884,7 +886,8 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
>   		     local->ops->remain_on_channel &&
>   		     memcmp(sdata->vif.cfg.ap_addr, mgmt->bssid, ETH_ALEN))) {
>   			need_offchan = true;
> -		} else if (sdata->u.mgd.associated &&
> +		} else if (!params->no_sta &&
> +			   sdata->u.mgd.associated &&
>   			   ether_addr_equal(sdata->vif.cfg.ap_addr, mgmt->da)) {
>   			sta = sta_info_get_bss(sdata, mgmt->da);
>   			mlo_sta = sta && sta->sta.mlo;
> @@ -1022,7 +1025,9 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
>   	}
>   
>   	if (!need_offchan) {
> -		ieee80211_tx_skb_tid(sdata, skb, NULL, 7, link_id);
> +		ieee80211_tx_skb_tid(sdata, skb,
> +				     params->no_sta ? sta : ERR_PTR(-ENOENT),
While testing this patch, I observed failures in some existing hwsim 
802.1X/EAP/DSCP test cases.

The logic seems odd to me: params->no_sta ? sta : ERR_PTR(-ENOENT)

Since sta_info_get_bss() is skipped when params->no_sta is set, 
shouldn't we pass ERR_PTR(-ENOENT) when params->no_sta is true and sta 
otherwise?
This may be related to the hwsim failures I'm seeing?

> +				     7, link_id);
>   		ret = 0;
>   		goto out_unlock;
>   	}

Thanks,
Ramasamy