Skip to content

Commit

Permalink
mac80211: fix statistics leak if dev_alloc_name() fails
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: 5a49051 ("mac80211: use per-CPU TX/RX statistics")
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg-intel committed Apr 27, 2016
1 parent 8f815cd commit e6436be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,

ret = dev_alloc_name(ndev, ndev->name);
if (ret < 0) {
free_netdev(ndev);
ieee80211_if_free(ndev);
return ret;
}

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

ret = register_netdevice(ndev);
if (ret) {
free_netdev(ndev);
ieee80211_if_free(ndev);
return ret;
}
}
Expand Down

0 comments on commit e6436be

Please sign in to comment.