]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mac80211: cleanup error path of ieee80211_do_open
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 25 Mar 2026 13:48:23 +0000 (15:48 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 25 Mar 2026 19:50:49 +0000 (20:50 +0100)
If we failed on drv_start, we currently cleanup AP_VLAN reference to
bss.
But this is not needed, since AP_VLAN must be tied to a pre-existing AP
interface, so open_count cannot be 0, so we will never call drv_start
for AP_VLAN interfaces.

Remove these cleanup and return immediately instead.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260325154742.3c532a9132c3.Idac5c38d5ad7ce97782a8c05ae72bb0c689c4fa9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c

index 232fc0b80e44cc693b97e33da0d0afa2e297334b..234de4762be52916969f7319977e0e4b5fd277be 100644 (file)
@@ -1361,8 +1361,6 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
                break;
                }
        case NL80211_IFTYPE_AP:
-               sdata->bss = &sdata->u.ap;
-               break;
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_STATION:
        case NL80211_IFTYPE_MONITOR:
@@ -1387,8 +1385,13 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
                local->reconfig_failure = false;
 
                res = drv_start(local);
-               if (res)
-                       goto err_del_bss;
+               if (res) {
+                       /*
+                        * no need to worry about AP_VLAN cleanup since in that
+                        * case we can't have open_count == 0
+                        */
+                       return res;
+               }
                ieee80211_led_radio(local, true);
                ieee80211_mod_tpt_led_trig(local,
                                           IEEE80211_TPT_LEDTRIG_FL_RADIO, 0);
@@ -1459,6 +1462,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
                netif_carrier_on(dev);
                list_add_tail_rcu(&sdata->u.mntr.list, &local->mon_list);
                break;
+       case NL80211_IFTYPE_AP:
+               sdata->bss = &sdata->u.ap;
+               fallthrough;
        default:
                if (coming_up) {
                        ieee80211_del_virtual_monitor(local);
@@ -1547,10 +1553,10 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
  err_stop:
        if (!local->open_count)
                drv_stop(local, false);
- err_del_bss:
-       sdata->bss = NULL;
        if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
                list_del(&sdata->u.vlan.list);
+       /* Might not be initialized yet, but it is harmless */
+       sdata->bss = NULL;
        return res;
 }