Skip to content

Commit e6436be

Browse files
committed
mac80211: fix statistics leak if dev_alloc_name() fails
In the case that dev_alloc_name() fails, e.g. because the name was given by the user and already exists, we need to clean up properly and free the per-CPU statistics. Fix that. Cc: stable@vger.kernel.org Fixes: 5a49051 ("mac80211: use per-CPU TX/RX statistics") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 8f815cd commit e6436be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/mac80211/iface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
17611761

17621762
ret = dev_alloc_name(ndev, ndev->name);
17631763
if (ret < 0) {
1764-
free_netdev(ndev);
1764+
ieee80211_if_free(ndev);
17651765
return ret;
17661766
}
17671767

@@ -1847,7 +1847,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
18471847

18481848
ret = register_netdevice(ndev);
18491849
if (ret) {
1850-
free_netdev(ndev);
1850+
ieee80211_if_free(ndev);
18511851
return ret;
18521852
}
18531853
}

0 commit comments

Comments
 (0)