提交 008aa66b 编写于 作者: N Nguyen Dinh Phi 提交者: Yang Yingliang

cfg80211: Fix possible memory leak in function cfg80211_bss_update

stable inclusion
from linux-4.19.201
commit 672f6ea510391a85dfce3362ad5d832bce447c14

--------------------------------

commit f9a5c358 upstream.

When we exceed the limit of BSS entries, this function will free the
new entry, however, at this time, it is the last door to access the
inputed ies, so these ies will be unreferenced objects and cause memory
leak.
Therefore we should free its ies before deallocating the new entry, beside
of dropping it from hidden_list.
Signed-off-by: NNguyen Dinh Phi <phind.uet@gmail.com>
Link: https://lore.kernel.org/r/20210628132334.851095-1-phind.uet@gmail.comSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5db34f33
...@@ -1029,16 +1029,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, ...@@ -1029,16 +1029,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
* be grouped with this beacon for updates ... * be grouped with this beacon for updates ...
*/ */
if (!cfg80211_combine_bsses(rdev, new)) { if (!cfg80211_combine_bsses(rdev, new)) {
kfree(new); bss_ref_put(rdev, new);
goto drop; goto drop;
} }
} }
if (rdev->bss_entries >= bss_entries_limit && if (rdev->bss_entries >= bss_entries_limit &&
!cfg80211_bss_expire_oldest(rdev)) { !cfg80211_bss_expire_oldest(rdev)) {
if (!list_empty(&new->hidden_list)) bss_ref_put(rdev, new);
list_del(&new->hidden_list);
kfree(new);
goto drop; goto drop;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册