Skip to content

Commit 86f3e44

Browse files
jmberg-intelgregkh
authored andcommitted
mac80211: bail out if cipher schemes are invalid
[ Upstream commit db878e2 ] 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: 2475b1c ("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>
1 parent 8499314 commit 86f3e44

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎net/mac80211/main.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,8 +1138,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
11381138
if (local->hw.wiphy->max_scan_ie_len)
11391139
local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
11401140

1141-
WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
1142-
local->hw.n_cipher_schemes));
1141+
if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
1142+
local->hw.n_cipher_schemes))) {
1143+
result = -EINVAL;
1144+
goto fail_workqueue;
1145+
}
11431146

11441147
result = ieee80211_init_cipher_suites(local);
11451148
if (result < 0)

0 commit comments

Comments
 (0)