summaryrefslogtreecommitdiff
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2021-04-08 15:31:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 11:57:32 +0300
commit685516a13ffa758e0bd50025c682dde8a5482c98 (patch)
tree490c9e46d887c5a6b066c702c74c1fb36009ffca /net/mac80211
parentbd62a39738d6409eeec70ab5f79a1b0a70373644 (diff)
downloadlinux-685516a13ffa758e0bd50025c682dde8a5482c98.tar.xz
mac80211: bail out if cipher schemes are invalid
[ Upstream commit db878e27a98106a70315d264cc92230d84009e72 ] If any of the cipher schemes specified by the driver are invalid, bail out and fail the registration rather than just warning. Otherwise, we might later crash when we try to use the invalid cipher scheme, e.g. if the hdr_len is (significantly) less than the pn_offs + pn_len, we'd have an out-of-bounds access in RX validation. Fixes: 2475b1cc0d52 ("mac80211: add generic cipher scheme support") Link: https://lore.kernel.org/r/20210408143149.38a3a13a1b19.I6b7f5790fa0958ed8049cf02ac2a535c61e9bc96@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 2136ce3b4489..a24acd0ee788 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1043,8 +1043,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
if (local->hw.wiphy->max_scan_ie_len)
local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
- WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
- local->hw.n_cipher_schemes));
+ if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
+ local->hw.n_cipher_schemes))) {
+ result = -EINVAL;
+ goto fail_workqueue;
+ }
result = ieee80211_init_cipher_suites(local);
if (result < 0)