cfg80211: limit scan results cache size
authorJohannes Berg <johannes.berg@intel.com>
Tue, 15 Nov 2016 11:05:11 +0000 (12:05 +0100)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:15:23 +0000 (13:15 +0000)
commitf7fbf117fb6325441a4500a3790f4dc55462430b
tree627c5846d23f161dcc578ff03600c148f5429421
parenta3781ef1a0c8f3a8327427627c4a5aa96f148dd3
cfg80211: limit scan results cache size

commit 9853a55ef1bb66d7411136046060bbfb69c714fa upstream.

It's possible to make scanning consume almost arbitrary amounts
of memory, e.g. by sending beacon frames with random BSSIDs at
high rates while somebody is scanning.

Limit the number of BSS table entries we're willing to cache to
1000, limiting maximum memory usage to maybe 4-5MB, but lower
in practice - that would be the case for having both full-sized
beacon and probe response frames for each entry; this seems not
possible in practice, so a limit of 1000 entries will likely be
closer to 0.5 MB.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/wireless/core.h
net/wireless/scan.c