Skip to content

Commit 67aa030

Browse files
mkozlowskilinvjw
authored andcommitted
mac80211: fix possible NULL pointer dereference
This patch moves 'key' dereference after BUG_ON(!key) so that when key is NULL we will see proper trace instead of oops. Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 1f951a7 commit 67aa030

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/mac80211/key.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,12 @@ int ieee80211_key_link(struct ieee80211_key *key,
400400
{
401401
struct ieee80211_key *old_key;
402402
int idx, ret;
403-
bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
403+
bool pairwise;
404404

405405
BUG_ON(!sdata);
406406
BUG_ON(!key);
407407

408+
pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
408409
idx = key->conf.keyidx;
409410
key->local = sdata->local;
410411
key->sdata = sdata;

0 commit comments

Comments
 (0)