From patchwork Fri Jun 2 22:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Lund X-Patchwork-Id: 13265940 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 364EEC7EE2C for ; Fri, 2 Jun 2023 22:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236720AbjFBW6f (ORCPT ); Fri, 2 Jun 2023 18:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236675AbjFBW6c (ORCPT ); Fri, 2 Jun 2023 18:58:32 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FAB7E40 for ; Fri, 2 Jun 2023 15:58:31 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-ba81b24b878so3553887276.3 for ; Fri, 02 Jun 2023 15:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685746710; x=1688338710; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=3ZyKSFX9mbFEpxkW7+RsW7XcjXG7U8cVIRswtejyB9g=; b=2pzXrZilZ7Bcom6WaEPYFcREl/2z+mMdTIIoCasFOVp9elYTIBqUsvNruRF80xUTQl UYILmU4EAjQ/LBj98zr08NdA1slg/dEucypM65FWCKjN4/kmu/x1LttRWgcf5UMI/VXM 4TGtOTT8so+PXbZU+JvNwM32WfRiVmyGWpS9PZfaCE3/Chv9b9+z02bZdk3wl+5olaj+ No1xbklWaYq4CvHLQvb73CFx4ybbBq6a8xuFfOOsLPDEXHbKJZKSiXMyP9inSmeIU/Vh uleJ3m8sg5mVBnQLbSSn09+BqgcWDzeOFHSPTQwltSAXX2AejOYSeyBKHUo9RiQ9QR6p czCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685746710; x=1688338710; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3ZyKSFX9mbFEpxkW7+RsW7XcjXG7U8cVIRswtejyB9g=; b=S0Ads+sBKPOUHRPp3FyDhC65BZm4pEHPfhn7JCXyxqppO3zowvpuLnnGVkG0ugaeWZ xkz31wcdIhkB7bKOPpNYYrapChfe8M8MsVFJQ9F4oafiW8XnIDXo9iaUueaZ9vZJ1H8N C7QrpbYsA8/r0khhjRcgr+rE8PhHfCjLGeIfPGo/UBPhk9CeRyqHBtqXOQ3Gr/SA9ygH sBWTk4rtlugkMMg/bsaKXluC83Jkok2V/8/38nl3whgeaN5KvykLraQHEI7mqck3LIy6 uOODy+g7/ruEOwsORDtEenqlQV7SGACqmsYMwyMWRC4HrfC67MMyi/sZSscf+OqLyADp XVbQ== X-Gm-Message-State: AC+VfDzCt85qDKRRondye6AVi86vLeX6HeYoAxo0y3xtGur/M6VdiLdR w8Qd77c41pWmv6G/krgcTgPxI3OPP7I= X-Google-Smtp-Source: ACHHUZ5epWr+KLvsq4wxXvbLgvhJs9/CIEEGvPBMJz7lOWLRL813+U+/wlzLqS+S4C/NlymbtACQaVJf4Bk= X-Received: from kglund1.bld.corp.google.com ([2620:15c:183:200:a5cd:5418:e5f2:aca5]) (user=kglund job=sendgmr) by 2002:a25:e443:0:b0:ba8:1e5f:850f with SMTP id b64-20020a25e443000000b00ba81e5f850fmr1465907ybh.10.1685746710076; Fri, 02 Jun 2023 15:58:30 -0700 (PDT) Date: Fri, 2 Jun 2023 16:57:50 -0600 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230602225751.164525-1-kglund@google.com> Subject: [PATCH 1/2] wifi: cfg80211: Reject (re-)association to the same BSSID From: Kevin Lund To: johannes@sipsolutions.net, linux-wireless@vger.kernel.org Cc: Kevin Lund Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Within cfg80211_connect, reject the (re-)association request if we are already connected to the exact BSSID which is being requested. This prevents an unnecessary attempt to connect which in the best case leaves us back where we started. There is precedent for behaving this way over on the userspace SME side of things in cfg80211_mlme_auth. Further, cfg80211_connect already makes several basic checks to ensure the connection attempt is reasonable, so this fits in that context. Signed-off-by: Kevin Lund --- net/wireless/sme.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 7bdeb8eea92dc..8f88e66bc85fc 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -1442,7 +1442,8 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, /* * If connected, reject (re-)association unless prev_bssid - * matches the current BSSID. + * matches the current BSSID. Also reject if the current BSSID matches + * the desired BSSID. */ if (wdev->connected) { if (!prev_bssid) @@ -1450,6 +1451,9 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, if (!ether_addr_equal(prev_bssid, wdev->u.client.connected_addr)) return -ENOTCONN; + if (ether_addr_equal(wdev->current_bss->pub.bssid, + connect->bssid)) + return -EALREADY; } /* From patchwork Fri Jun 2 22:57:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Lund X-Patchwork-Id: 13265941 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64550C7EE2C for ; Fri, 2 Jun 2023 22:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236675AbjFBW6o (ORCPT ); Fri, 2 Jun 2023 18:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236467AbjFBW6m (ORCPT ); Fri, 2 Jun 2023 18:58:42 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DACEFE40 for ; Fri, 2 Jun 2023 15:58:38 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5659cfd627dso39272727b3.2 for ; Fri, 02 Jun 2023 15:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685746718; x=1688338718; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=QhTMWm7QFFgSbHkbOWfdA14D72uDfJV2WhL1oS/z9is=; b=U6R666rMvV8N6MzZyn9MSIAtaLChZI1h4enUtXtJXD7fbyeh0YrdlY0B+sTtLoBW9J CcrQ6Y1wNgUJbWcZF/JxLqD2/VVFd41MZuL32OLv3BUIXq4gDb1TJd6xRAM+GORPiK50 FEslMaspC4mVAddlLd4eM4ZNqN86sS24JxmpxpxdkxRIxW9sACv8NIKOeUcfh8sgCrmu 7DpiksAETyZ/Tc3p1GLTYoeQhCC5CQgyCpvgZ0Ii6rLeI4mN1x/QoCJBmTl+u+p2KIFR ObPgeMWnusR+khFo3RQlyoM3Ucs12gcqTX3/E1yuFOPDsPhladPB8lTtQecAY+cDyjoU Kn7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685746718; x=1688338718; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QhTMWm7QFFgSbHkbOWfdA14D72uDfJV2WhL1oS/z9is=; b=FH6HI0jv9uvQsR+XmpZe9zXfbbSURj3hBo9ckDXcolr00H12FOYMBt/XnG97gGkNbh p1f8lzfMn/kKUZEjh5io0KDi6ndeU8XP+6lBjHHW7O8PK9uHuDIZlP9SCMEs/rc+EHf5 maL1IRwgIBYPlZUlfvtU3JWzQyKKd7G2B2B+3K+IUj1MFWAbVeOVALvecpvHZtcHI567 Dh3O7KTnjr7vO8p4X+vvQj1VWbe44miV1A4uzZv6DRRAYTGgP7bqx380v95yo8G3xpl3 41yKNk98DRIFlXRZv7lzow9YEcjU0lvdRjmfIJwa9zzTOyRyvLp6nc6KjNnq4dfffQlp gbhA== X-Gm-Message-State: AC+VfDzBKfBZnZ4hJfuC928kuCIQGxqjtvDjZtrpXTI8W6DUIO1NCdue bnZMtjvyvfZQJlZrb6w+2jyU9p6VWps= X-Google-Smtp-Source: ACHHUZ72BOotxTxKf6sfqxFc/lQgBW7K5+6B5Q9hnluS511cfw4gOc5IqrIBSkJ9jmMhfIkDWKWhYkxZQ1Q= X-Received: from kglund1.bld.corp.google.com ([2620:15c:183:200:a5cd:5418:e5f2:aca5]) (user=kglund job=sendgmr) by 2002:a81:a805:0:b0:54f:b56a:cd0f with SMTP id f5-20020a81a805000000b0054fb56acd0fmr724030ywh.3.1685746718170; Fri, 02 Jun 2023 15:58:38 -0700 (PDT) Date: Fri, 2 Jun 2023 16:57:51 -0600 In-Reply-To: <20230602225751.164525-1-kglund@google.com> Mime-Version: 1.0 References: <20230602225751.164525-1-kglund@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230602225751.164525-2-kglund@google.com> Subject: [PATCH 2/2] wifi: mwifiex: Stop rejecting connection attempts while connected From: Kevin Lund To: johannes@sipsolutions.net, linux-wireless@vger.kernel.org Cc: Kevin Lund Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Currently, the Marvell WiFi driver rejects any connection attmept while we are currently connected. This is poor logic, since there are several legitimate use-cases for initiating a connection attempt while connected, including re-association and BSS Transitioning. This logic means that it's impossible for userspace to request the driver to connect to a different BSS on the same ESS without explicitly requesting a disconnect first. Remove the check from the driver so that we can complete BSS transitions on the first attempt. Testing on Chrome OS has shown that this change resolves some issues with failed BSS transitions. Signed-off-by: Kevin Lund --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index bcd564dc3554a..84d650c9dceb0 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2414,12 +2414,6 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, return -EINVAL; } - if (priv->wdev.connected) { - mwifiex_dbg(adapter, ERROR, - "%s: already connected\n", dev->name); - return -EALREADY; - } - if (priv->scan_block) priv->scan_block = false;