From: Petr Štetiar Date: Sun, 27 Mar 2011 11:31:26 +0000 (+0200) Subject: mac80211: fix NULL pointer dereference in ieee80211_key_alloc() X-Git-Tag: v2.6.39-rc2~7^2~8^2~9 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f951a7f8ba05192291f781ef99a892697e47d62;p=pandora-kernel.git mac80211: fix NULL pointer dereference in ieee80211_key_alloc() The ieee80211_key struct can be kfree()d several times in the function, for example if some of the key setup functions fails beforehand, but there's no check if the struct is still valid before we call memcpy() and INIT_LIST_HEAD() on it. In some cases (like it was in my case), if there's missing aes-generic module it could lead to the following kernel OOPS: Unable to handle kernel NULL pointer dereference at virtual address 0000018c .... PC is at memcpy+0x80/0x29c ... Backtrace: [] (ieee80211_key_alloc+0x0/0x234 [mac80211]) from [] (ieee80211_add_key+0x70/0x12c [mac80211]) [] (ieee80211_add_key+0x0/0x12c [mac80211]) from [] (__cfg80211_set_encryption+0x2a8/0x464 [cfg80211]) Signed-off-by: Petr Štetiar Reviewed-by: Johannes Berg Signed-off-by: John W. Linville --- Reading git-diff-tree failed