From patchwork Sat Mar 26 17:32:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 665881 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2QHdSGd013433 for ; Sat, 26 Mar 2011 17:39:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344Ab1CZRj0 (ORCPT ); Sat, 26 Mar 2011 13:39:26 -0400 Received: from ibawizard.net ([82.208.49.253]:39522 "EHLO mengele.ibawizard.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753234Ab1CZRj0 (ORCPT ); Sat, 26 Mar 2011 13:39:26 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 26 Mar 2011 17:39:32 +0000 (UTC) X-Greylist: delayed 402 seconds by postgrey-1.27 at vger.kernel.org; Sat, 26 Mar 2011 13:39:25 EDT Received: from ntbk.lan (localhost [127.0.0.1]) by mengele.ibawizard.net (Postfix) with ESMTP id B0A561D360A9; Sat, 26 Mar 2011 18:32:37 +0100 (CET) From: =?UTF-8?q?Petr=20=C5=A0tetiar?= To: linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Petr=20=C5=A0tetiar?= , Johannes Berg Subject: [PATCH] mac80211: fix NULL pointer dereference in ieee80211_key_alloc() Date: Sat, 26 Mar 2011 18:32:42 +0100 Message-Id: <1301160762-8409-1-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 8c02469..8e49850 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -364,8 +364,11 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, } break; } - memcpy(key->conf.key, key_data, key_len); - INIT_LIST_HEAD(&key->list); + + if (!IS_ERR(key)) { + memcpy(key->conf.key, key_data, key_len); + INIT_LIST_HEAD(&key->list); + } return key; }