]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: avoid excessive stack usage in sta_info
authorArnd Bergmann <arnd@arndb.de>
Tue, 26 Jan 2016 22:05:31 +0000 (23:05 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 24 Feb 2016 08:04:28 +0000 (09:04 +0100)
commitcbef21258d1d62932b43d2a3dee5e7824d6b105c
treea6c3d5acd8a3f163271b0b867f3d7d3dfb238adb
parent20e59cb6ad9bd04e1ea80baf0b5a86e2023af0e3
mac80211: avoid excessive stack usage in sta_info

When CONFIG_OPTIMIZE_INLINING is set, the sta_info_insert_finish
function consumes more stack than normally, exceeding the
1024 byte limit on ARM:

net/mac80211/sta_info.c: In function 'sta_info_insert_finish':
net/mac80211/sta_info.c:561:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

It turns out that there are two functions that put a 'struct station_info'
on the stack: __sta_info_destroy_part2 and sta_info_insert_finish, and
this structure alone requires up to 792 bytes.

Hoping that both are called rarely enough, this replaces the
on-stack structure with a dynamic allocation, which unfortunately
requires some suboptimal error handling for out-of-memory.

The __sta_info_destroy_part2 function is actually affected by the
stack usage twice because it calls cfg80211_del_sta_sinfo(), which
has another instance of struct station_info on its stack.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f7c7dfe79fa4 ("mac80211/cfg80211: add station events")
Fixes: 7b3c36bfefa3 ("mac80211: send statistics with delete station event")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/sta_info.c