Skip to content

Commit

Permalink
mac80211: fix possible NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mariusz Kozlowski authored and John W. Linville committed Mar 28, 2011
1 parent 1f951a7 commit 67aa030
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,12 @@ int ieee80211_key_link(struct ieee80211_key *key,
{
struct ieee80211_key *old_key;
int idx, ret;
bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
bool pairwise;

BUG_ON(!sdata);
BUG_ON(!key);

pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
idx = key->conf.keyidx;
key->local = sdata->local;
key->sdata = sdata;
Expand Down

0 comments on commit 67aa030

Please sign in to comment.