From: Mariusz Kozlowski Date: Sat, 26 Mar 2011 17:58:51 +0000 (+0100) Subject: mac80211: fix possible NULL pointer dereference X-Git-Tag: v2.6.39-rc2~7^2~8^2~8 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=67aa030c0dff6095128bcb4e8043b48360f32331;p=~shefty%2Frdma-dev.git 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 Acked-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 09cf1f28c12..af3c56482c8 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -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;