mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
wifi: cfg80211: check if AP has been started or joined a mesh before adding new station
Adding a new station to AP makes only sense when the AP has been started (nl80211_start_ap()) or joined a mesh (__cfg80211_join_mesh()). Check if AP is up and beaconing on the link or joined the mesh, when adding new station. Return error if this isn't the case. Note that libertas devices need special handling since they do not implement join_mesh() and the decision must be made on channel definition. Reported-by: syzbot+9bdc0c5998ab45b05030@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9bdc0c5998ab45b05030 Signed-off-by: Slawomir Stepien <sst@poczta.fm> Link: https://patch.msgid.link/20260910080418.725741-3-sst@poczta.fm Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
e3d1acb027
commit
a842cfc1d6
|
|
@ -9336,7 +9336,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
|
|||
static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev = info->user_ptr[0];
|
||||
int err;
|
||||
int err, link_id;
|
||||
struct wireless_dev *wdev = info->user_ptr[1];
|
||||
struct net_device *dev = wdev->netdev;
|
||||
struct station_parameters params;
|
||||
|
|
@ -9575,6 +9575,11 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
|
|||
switch (wdev->iftype) {
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
/* Add a new station only after the AP and link has been started */
|
||||
link_id = wdev->valid_links ? params.link_sta_params.link_id : 0;
|
||||
if (!wdev->links[link_id].ap.beacon_interval)
|
||||
return -ENETDOWN;
|
||||
|
||||
/* ignore WME attributes if iface/sta is not capable */
|
||||
if (!(rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) ||
|
||||
!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME)))
|
||||
|
|
@ -9619,6 +9624,19 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
|
|||
return PTR_ERR(params.vlan);
|
||||
break;
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
/*
|
||||
* Add a new station only after the mesh has been started.
|
||||
* libertas doesn't implement join_mesh(); it configures the
|
||||
* mesh via sysfs and joins it when the channel is set, so
|
||||
* use that as the started indication instead.
|
||||
*/
|
||||
if (rdev->ops->libertas_set_mesh_channel) {
|
||||
if (!wdev->u.mesh.chandef.chan)
|
||||
return -ENETDOWN;
|
||||
} else if (!wdev->u.mesh.beacon_interval) {
|
||||
return -ENETDOWN;
|
||||
}
|
||||
|
||||
/* ignore uAPSD data */
|
||||
params.sta_modify_mask &= ~STATION_PARAM_APPLY_UAPSD;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user