Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6856367rwb; Wed, 18 Jan 2023 10:10:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXs/wZdyGNQDwwmaskSEZl2NC9SsAUPA8/sgxEVSrAahZ2nBcM+BCdecCMv8sAH/MPMRjw/i X-Received: by 2002:a05:6a20:a802:b0:b8:b02d:9415 with SMTP id cb2-20020a056a20a80200b000b8b02d9415mr6296956pzb.12.1674065425689; Wed, 18 Jan 2023 10:10:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674065425; cv=none; d=google.com; s=arc-20160816; b=d4CGn9UK3y0iGzdhFCUwm54evZPyxsbL50ewVntvWQ9pACLBGLFvJlt7HnmvK4+6oj Cv9P3BdUe5DHepXW2+8Gcq+MwdXN5XdAu3HeI2p3Q1mYZzTzrS+x4nnKz+JYBjilZbs/ mC/F+YjDF71qQmvCFwLSijKrv6UtMYch/77/twalfhSWFn16U8D/SlXXLz4b6fktlS2U YbWljB7ZwEpa2OExKKtYU9OfD8MpBjUSrkjnn7zh3LCyOCM7jCfWFSjyEZC5/AchGeCc Rc2N9HPCjmULnzFJfKYUtX82PaK7X1lLukLB0aMNJCjjZEGfcG/asUl4AgDWVa19fzrD FLrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id:dkim-signature; bh=6yo5uDRXZObQgdR1UYMEVi699rT0IOSxbVKZzjhBQvk=; b=i2qxHGELkTfdPM08kSo9tBYz9g/P7yJp1Bexwlu8Rldl1WOCwg6iTl9mU1HC+we1Ln UKPo28BRZ2AahWPyFLTmmdTrmQ7vU6fnREtLSRkigt8cn8C6pco97isUHQv9jE9VSOj1 g8ZgaRjzl5l+eTQ+urEWq0waxUbOjZJH9TQGTxlcUBQdgeH04Bn0lzKdnuspM2mor67r xyGlquC6hAt6w6igompXHrmH4Vig+W00dMab8VXtwGBXhvqnMW2mrcod4+BT0QHUXwkT NkglqsfBlfK646NYlutUgHQ5ZhqU/4au1zufqkvfVFd2sji15BIuGxqZHnNyLl+elHes FgYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=hVJ4Y3YP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v184-20020a6389c1000000b004b353c89e27si30278063pgd.429.2023.01.18.10.10.16; Wed, 18 Jan 2023 10:10:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=hVJ4Y3YP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229749AbjARSKL (ORCPT + 63 others); Wed, 18 Jan 2023 13:10:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjARSJ3 (ORCPT ); Wed, 18 Jan 2023 13:09:29 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F1F5A360 for ; Wed, 18 Jan 2023 10:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:To:From:Subject:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=6yo5uDRXZObQgdR1UYMEVi699rT0IOSxbVKZzjhBQvk=; t=1674065340; x=1675274940; b=hVJ4Y3YPzTvvgw34U3y0ldqa9vcKd10b6tva+nT/W+bNm/s KQMcO6gDLMEGBUtJeOcM9yb0HkIbD0ISajtJr9cIl8wYewXkHJ+k4wCq4vwjjeekO2OeX6KIJlX9I ecqyjGKYTtYJuD/PL5A6lsd/geOOBCFw9N1gKBzJ6yuqXHnZOzbe5hIustTVllMiftlyx5DUeFuUw s+KDHgEcC0vxakcLK4PLOqCIy6UgNW37UVYaUL3pkjmqNYJb+m7h8lzOcCoSc5yXG3rpZE5+iuYo8 q1MD37W9n5z/TzR44UDBBmrF5Iazha/6wCmDfHbFoIKHN1KA256OquMkBCFrRrkA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1pICrq-005iYZ-2z; Wed, 18 Jan 2023 19:08:59 +0100 Message-ID: Subject: Re: [PATCH 0/1] Fix __ieee80211_disconnect when not associated From: Johannes Berg To: James Prestwood , linux-wireless@vger.kernel.org Date: Wed, 18 Jan 2023 19:08:57 +0100 In-Reply-To: <52746d84e1961ee6cb896a8f23d6857774945014.camel@gmail.com> References: <20221025203443.410121-1-prestwoj@gmail.com> <6b963cb79064fb70eeba7fdcc6ff5abb25348144.camel@sipsolutions.net> <52746d84e1961ee6cb896a8f23d6857774945014.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 On Wed, 2023-01-18 at 09:54 -0800, James Prestwood wrote: > >=20 > > Basically I don't understand why userspace expects some event. It > > asked > > for authentication, and you got it. That's all. I don't see userspace > > asking for association, or anything else, so what would it be waiting > > for? >=20 > I should have explained this better. I dug up the old thread from the > original report and IIRC this is the sequence of events: >=20 > 1. Begin reassociation to new BSS via CMD_CONNECT. >=20 Oh, CMD_CONNECT, OK. > This results in the > kernel sending many events to remove the current BSS in favor of the > new one: >=20 > 2. Receive DEL_STATION, DEAUTHENTICATE, DISCONNECT, NEW_STATION So far, so good. > 3. Then a CMD_AUTHENTICATE, with a success status. Sure, that's what we see. > 4. At this point the firmware decides its not gonna continue and calls > __ieee80211_disconnect which is a no-op when not associated. >=20 This is also completely irrelevant to the state. The firmware doesn't "decide not to continue". Something else already decided it doesn't want to continue. This is entirely driven from the top - be it the net/wireless/sme.c for CMD_CONNECT, or userspace for CMD_AUTHENTICATE and CMD_ASSOCIATE. > We assumed > either CMD_ASSOCIATE or CMD_CONNECT will come after CMD_AUTHENTICATE, > or a CMD_DEAUTH if there was a problem. Yeah for CMD_CONNECT I guess that's reasonable. In fact you really shouldn't even look at the authenticate/associate even in these cases since they're not guaranteed (e.g. if you have a fullmac device), they only happen as a consequence of the mac80211 implementation, not by design. So I think you're just looking in the wrong place - the real question is why the association sequence in net/wireless/sme.c doesn't continue (or abort) at this point? The whole "firmware event" thing is completely incidental and an implementation detail. The firmware decides nothing. All that happens here is that the firmware decided to no longer wait for the association to happen (but that wasn't even started), and a driver bug that basically just prints the wrong message - it says it's expecting to be associated but it can't actually expect that since we never even transmitted an association request. > I will say, we do see a CMD_DEL_STATION event here which we never > processed in this case. And you probably shouldn't anyway, again more of an implementation detail, not really by design. > But again, I would expect a CMD_DEAUTHENTICATE > since we successfully authenticated, right? No, you can't expect that, you could be authenticated with the AP for an indefinite amount of time, or never hear the deauth frame (if it ever sends one). johannes