cfg80211: Fix possible memory leak in function cfg80211_bss_update
authorNguyen Dinh Phi <phind.uet@gmail.com>
Mon, 28 Jun 2021 13:23:34 +0000 (21:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Aug 2021 09:58:03 +0000 (11:58 +0200)
commitf6ba582293b84ab28b8e3e7a2cc5f99bedecb6c4
tree29016bdb0e0f8d687007e2b2cb1fc5c4d894822a
parent9c2c5bb21fa70d8231d3c4f48258ca62af2c5927
cfg80211: Fix possible memory leak in function cfg80211_bss_update

commit f9a5c358c8d26fed0cc45f2afc64633d4ba21dff 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: Nguyen Dinh Phi <phind.uet@gmail.com>
Link: https://lore.kernel.org/r/20210628132334.851095-1-phind.uet@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/wireless/scan.c