From patchwork Sun Mar 27 11:31:26 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: 666501 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 p2RBVVZb011181 for ; Sun, 27 Mar 2011 11:31:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753316Ab1C0Lba (ORCPT ); Sun, 27 Mar 2011 07:31:30 -0400 Received: from ibawizard.net ([82.208.49.253]:40642 "EHLO mengele.ibawizard.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753314Ab1C0Lb3 (ORCPT ); Sun, 27 Mar 2011 07:31:29 -0400 Received: from ntbk.lan (localhost [127.0.0.1]) by mengele.ibawizard.net (Postfix) with ESMTP id 4D2041D36069; Sun, 27 Mar 2011 13:31:25 +0200 (CEST) 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 v2] mac80211: fix NULL pointer dereference in ieee80211_key_alloc() Date: Sun, 27 Mar 2011 13:31:26 +0200 Message-Id: <1301225486-23597-1-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1301217408.3826.2.camel@jlt3.sipsolutions.net> References: <1301217408.3826.2.camel@jlt3.sipsolutions.net> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 27 Mar 2011 11:31:32 +0000 (UTC) diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 8c02469..09cf1f2 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -342,7 +342,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, if (IS_ERR(key->u.ccmp.tfm)) { err = PTR_ERR(key->u.ccmp.tfm); kfree(key); - key = ERR_PTR(err); + return ERR_PTR(err); } break; case WLAN_CIPHER_SUITE_AES_CMAC: @@ -360,7 +360,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, if (IS_ERR(key->u.aes_cmac.tfm)) { err = PTR_ERR(key->u.aes_cmac.tfm); kfree(key); - key = ERR_PTR(err); + return ERR_PTR(err); } break; }