Commit 13e5afd3 authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Johannes Berg

wifi: mac80211: fix memory leak in ieee80211_if_add()

When register_netdevice() failed in ieee80211_if_add(), ndev->tstats
isn't released. Fix it.

Fixes: 5a490510 ("mac80211: use per-CPU TX/RX statistics")
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20221117064500.319983-1-shaozhengchao@huawei.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5cc58b37
...@@ -2195,6 +2195,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -2195,6 +2195,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ret = cfg80211_register_netdevice(ndev); ret = cfg80211_register_netdevice(ndev);
if (ret) { if (ret) {
ieee80211_if_free(ndev);
free_netdev(ndev); free_netdev(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