Skip to content

Commit f9a5c35

Browse files
ita93jmberg-intel
authored andcommitted
cfg80211: Fix possible memory leak in function cfg80211_bss_update
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 0d05996 commit f9a5c35

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/wireless/scan.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,16 +1754,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
17541754
* be grouped with this beacon for updates ...
17551755
*/
17561756
if (!cfg80211_combine_bsses(rdev, new)) {
1757-
kfree(new);
1757+
bss_ref_put(rdev, new);
17581758
goto drop;
17591759
}
17601760
}
17611761

17621762
if (rdev->bss_entries >= bss_entries_limit &&
17631763
!cfg80211_bss_expire_oldest(rdev)) {
1764-
if (!list_empty(&new->hidden_list))
1765-
list_del(&new->hidden_list);
1766-
kfree(new);
1764+
bss_ref_put(rdev, new);
17671765
goto drop;
17681766
}
17691767

0 commit comments

Comments
 (0)