Commit 2ccc4eac authored by Johannes Berg's avatar Johannes Berg Committed by Kamal Mostafa

mac80211: fix statistics leak if dev_alloc_name() fails

commit e6436be2 upstream.

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.

Fixes: 5a490510 ("mac80211: use per-CPU TX/RX statistics")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 6ae35014
...@@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ret = dev_alloc_name(ndev, ndev->name); ret = dev_alloc_name(ndev, ndev->name);
if (ret < 0) { if (ret < 0) {
free_netdev(ndev); ieee80211_if_free(ndev);
return ret; return ret;
} }
...@@ -1826,7 +1826,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -1826,7 +1826,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ret = register_netdevice(ndev); ret = register_netdevice(ndev);
if (ret) { if (ret) {
free_netdev(ndev); ieee80211_if_free(ndev);
return ret; return ret;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment