2023-09-02 05:56:46

by shaozhengchao

[permalink] [raw]
Subject: Re: [PATCH net,v2] wifi: mac80211: fix WARNING in ieee80211_link_info_change_notify()



On 2023/9/1 14:32, Johannes Berg wrote:
> On Fri, 2023-09-01 at 11:53 +0800, Zhengchao Shao wrote:
>>
>> diff --git a/net/mac80211/main.c b/net/mac80211/main.c
>> index 24315d7b3126..f79e2343dddd 100644
>> --- a/net/mac80211/main.c
>> +++ b/net/mac80211/main.c
>> @@ -285,6 +285,9 @@ void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,
>> if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
>> return;
>>
>> + if (!ieee80211_sdata_running(sdata))
>> + return;
>> +
>> if (!check_sdata_in_driver(sdata))
>> return;
>>
>
> I don't think this is right. Do you see anything else checking that it's
> running right before checking it's in the driver? :)
>
> Why can we even get into this call at all? I think the problem is
> already in cfg80211 allowing this.
>
> johannes
>

Hi johannes:
Do you mean it shouldn't be allowed to set mcast rate when dev
is stopped, as in the following code?

--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1229,7 +1229,7 @@ rdev_set_mcast_rate(struct
cfg80211_registered_device *rdev,
int ret = -ENOTSUPP;

trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
- if (rdev->ops->set_mcast_rate)
+ if (rdev->ops->set_mcast_rate && netif_running(dev))
ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev,
mcast_rate);
trace_rdev_return_int(&rdev->wiphy, ret);
return ret;


Thank you

Zhengchao Shao