Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3403257rdh; Thu, 28 Sep 2023 10:31:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz9Mla+TUrcDeEwi52Zyw7vuVwnUHbrKcsvuaukQDLIKdI0LSZWjw7/HKe0G9q/OpAST6X X-Received: by 2002:a05:6358:8809:b0:143:864e:f96f with SMTP id hv9-20020a056358880900b00143864ef96fmr1893314rwb.1.1695922269858; Thu, 28 Sep 2023 10:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695922269; cv=none; d=google.com; s=arc-20160816; b=v3t2/m3iz8q/s8UOnqxgqCO/tIpXTG+Vdjjy6LB398OEf4BrVH0zHb6+O9gERR9FMS 2ZNIm9dSBt9MFCezvQOL8Lq7EM5ia2XqOpoQZ4fyAAFGcUVUsOe3TYku5YbRuWoSpNnn vIS7f9PkK6l6Gn77uUmRw3fWGSLPp75TH1cZZYItugaD4Dsze1zcSPLNVsuOdmBxNGHS 9xHM5W1MWSPIbRElW6pNCoTbN50N1v5x/DLrZwKRhIBTH1MI8U12k3Wf9PiRvZ+tunMb X1L1/gu1i/izx8kf7SbElMOsQJq4y54tM3XLIjCvXvuTJFu5UVAkNzJXcSVD3GrZGnjW gq4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2Ep6FVLzWIPMlQYEmbdKdtQ9H9V1Y4Vn+n/B4FbbKpI=; fh=Jp47DAEBZGYKvP+QhbZP30z/2qU5MmgU1PLrOH49x2Y=; b=ZqV80Nw88ZIApTvVuWJ6v/w/LkBEErl1be4K5yRdaR2tS7A0JNuygRPQlt5gkuAP3/ 7H16+At4E4wB9FTIuK4bWTe1T2snJcyPjXKwnUjcUae9SD3fTzcRao3dwcabdMEZDkep 9GTfaWxtKwLV64teZ/BzjFfSLELf/tNZjA/6gDgHGQuOMTE7293goBYc7jCPeMEDK6hr IMOsCNz8GihArAnrRORGkkk8QEqSrZACbfnyGGEQqqpMl3soyHPu7HYi5DMHgdSOD1wN QtHaoghqzQQ6m1orPYNG4Lu5dMvtiQcSUlQjeSaoH0P5qaJ/2l8POegr4cypm8CzefFR ZQig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lNFdshQI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n9-20020a63f809000000b00577475ee5f6si19061639pgh.618.2023.09.28.10.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 10:31:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lNFdshQI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E4AC980C4D67; Thu, 28 Sep 2023 07:35:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjI1Of5 (ORCPT + 55 others); Thu, 28 Sep 2023 10:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbjI1Of4 (ORCPT ); Thu, 28 Sep 2023 10:35:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F29A619D for ; Thu, 28 Sep 2023 07:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695911755; x=1727447755; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UbWqyNksiStUY8BysPpWEKAuiSEhX+dVWzIyeIZXMq0=; b=lNFdshQIeiXf/CnJHT1PqQzirVi86neCG7ldVh3erMMV6lJrw77nohkI U6v8mxhSmADt/bQUzMhT0oF2pdryiVuANCgrB5U/s2cmVmFYLuOsblpuY 0J6cP3wR7F+G7XSZSgsU3UZ7sICUKHq2iHschf7ybTrhnalwWfgU37O+A 90PJK1hS2uXGS4s0Cd+MfV562Co8ZsxoUMVCbEhBei3cumerpzmqQZw9E ibP8TtSLb5ZuA8HXYVbtaWMmqLQS6YcxK1z4bq2WmgL5RJKD0KZiJqCJc PxW/unlkbhO6Xlcnheb9AI9XLMIpgrMpSCRm5yos5AsFNNNHKr4GEOqG9 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="688398" X-IronPort-AV: E=Sophos;i="6.03,184,1694761200"; d="scan'208";a="688398" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 07:35:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="996590385" X-IronPort-AV: E=Sophos;i="6.03,184,1694761200"; d="scan'208";a="996590385" Received: from smoriles-mobl1.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.249.92.89]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 07:35:53 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg , Gregory Greenman Subject: [PATCH 01/18] wifi: mac80211: cleanup auth_data only if association continues Date: Thu, 28 Sep 2023 17:35:22 +0300 Message-Id: <20230928172905.c9855f46ebc8.I7f3dcd4120a186484a91b87560e9b7201d40984f@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230928143539.1037500-1-gregory.greenman@intel.com> References: <20230928143539.1037500-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 07:35:58 -0700 (PDT) From: Benjamin Berg If the association command fails then the authentication is still valid and it makes sense to keep it alive. Otherwise, we would currently get into an inconsistent state because mac80211 on the one hand is disconnected but on the other hand the state is not entirely cleared and a new authentication could not continue. Signed-off-by: Benjamin Berg Signed-off-by: Gregory Greenman --- net/mac80211/mlme.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index dc9a94bd3b11..e92598dcf3ed 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -7715,7 +7715,10 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, match = ether_addr_equal(ifmgd->auth_data->ap_addr, assoc_data->ap_addr) && ifmgd->auth_data->link_id == req->link_id; - ieee80211_destroy_auth_data(sdata, match); + + /* Cleanup is delayed if auth_data matches */ + if (!match) + ieee80211_destroy_auth_data(sdata, false); } /* prepare assoc data */ @@ -7938,11 +7941,17 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, run_again(sdata, assoc_data->timeout); + /* We are associating, clean up auth_data */ + if (ifmgd->auth_data) + ieee80211_destroy_auth_data(sdata, true); + return 0; err_clear: - eth_zero_addr(sdata->deflink.u.mgd.bssid); - ieee80211_link_info_change_notify(sdata, &sdata->deflink, - BSS_CHANGED_BSSID); + if (!ifmgd->auth_data) { + eth_zero_addr(sdata->deflink.u.mgd.bssid); + ieee80211_link_info_change_notify(sdata, &sdata->deflink, + BSS_CHANGED_BSSID); + } ifmgd->assoc_data = NULL; err_free: kfree(assoc_data); -- 2.38.1