From patchwork Wed Aug 8 19:34:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1297351 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9764F3FCFC for ; Wed, 8 Aug 2012 19:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753374Ab2HHTeb (ORCPT ); Wed, 8 Aug 2012 15:34:31 -0400 Received: from investici.nine.ch ([217.150.252.179]:59107 "EHLO confino.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297Ab2HHTe3 (ORCPT ); Wed, 8 Aug 2012 15:34:29 -0400 Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id D9C68C8677; Wed, 8 Aug 2012 19:34:24 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org D9C68C8677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1344454467; bh=WYzaKMRyuUFUmr/a5stPjhhwtB7rLw597fQvdQBCUaw=; h=From:To:Cc:Subject:Date:Message-Id; b=RUpwxm9ckIcP36M5ZCIMCUXIM5H/RJXp0i9cBL2B2tuaL6GcM8/5ojqb93xIdbUI5 j+hwB6BLJQFjUAY3iEqZfubwvL9Bvpv4kbBmYpVlWlGQHQ/qHpMa93oa8M/6bzgZSZ 0DyoO7hScL6rHUfeECQrp94cocTWiU4dYxQCxOkw= From: Antonio Quartulli To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Antonio Quartulli Subject: [PATCH] mac80211: do not reply to AUTH frame if sta allocation fails Date: Wed, 8 Aug 2012 21:34:12 +0200 Message-Id: <1344454452-19480-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.9.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Whenever we get an AUTH frame we first allocate a new station and then we reply with another AUTH frame. However, if sta allocations fails we have to do not reply so that the other hand do not think we have correctly set everything up Signed-off-by: Antonio Quartulli --- net/mac80211/ibss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5746d62..37e71a3 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -337,6 +337,7 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, size_t len) { u16 auth_alg, auth_transaction; + struct sta_info *sta; lockdep_assert_held(&sdata->u.ibss.mtx); @@ -352,10 +353,17 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction); sta_info_destroy_addr(sdata, mgmt->sa); - ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); + sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); rcu_read_unlock(); /* + * if we have any problem in allocating the new station, we do not reply + * with the AUTH frame + */ + if (!sta) + return; + + /* * IEEE 802.11 standard does not require authentication in IBSS * networks and most implementations do not seem to use it. * However, try to reply to authentication attempts if someone