Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1458823rwb; Tue, 29 Nov 2022 14:00:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+nq86KdnGv5E7KnS5MhI0OkgpEzSwHvZ1+6hwAl1PBVoLmr3Kkpw4+BpqHINfsDrlDRRA X-Received: by 2002:a17:90b:3809:b0:20a:c64c:ae80 with SMTP id mq9-20020a17090b380900b0020ac64cae80mr51517874pjb.12.1669759241028; Tue, 29 Nov 2022 14:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669759241; cv=none; d=google.com; s=arc-20160816; b=siEXqiqc0B+lSNR1Xv7j+cK9TqRcTuZfRAdMNRIcBz0QwQAT7aYPmcRsTB2Ol9wi3N i29cFFpJHWlTQ8GlkdTkvHEN97A9gl/2O3VBg6kIQRhMkbSeOV4oob5AJGb3UFd1EGB5 7315/py2e7ioZTI7ft0kWLH2+kE+ezf4MS0IA+BC1wcX804hFMs6KdXWgmA8KFP5nZer ZXrNd3oZ12DriTAEurI8zv3tAJwr0yxQ7Kedcl6jbPIalErghD8EylfACW4BrUusiKJK H13ojX7e5nFujFQqBKyBXpAC/lpw91cQ+u9wxqp+ipNA1NiKUmxQZp0eN69RRfDfkko+ r1pw== 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; bh=TH38Velay2+bpQVz3MzXudsBkZ7EGlWEN8wicl5hbZk=; b=bnCc9KPg0CrXXC4+N+vdydyofMDfZbO1i9fD/8REIs/siB5OhXUOMnJq8DKMYwhvvm GAvpCDe1i8SWPfVQyAryuA8IqxYaVFGleDvVPf4nlHqA1tAzFtjCxDz1ee3piUK7W4Je zYttatWW/HPr4SfrCtTdXXHP/37Ga/TjYUv71/sKAcco4KuPrfCO6xk3RjC0IGrgG7Id BbMVEyvXx/VLtp+ZbbKBUmRmD8kYX2Mbqzl1KZ6jnBPCC84Ebtj73kvYxdrfDV1EtlNv i+zXb2bAcrhCf/7htFtffz78AuNFyFNxKji/6qDMTv072WOm47BbFepxJtiVQCXz8JZT NnXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a63f947000000b00476caa56d0esi15771431pgk.739.2022.11.29.14.00.29; Tue, 29 Nov 2022 14:00:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236734AbiK2Uwf (ORCPT + 84 others); Tue, 29 Nov 2022 15:52:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236609AbiK2UwZ (ORCPT ); Tue, 29 Nov 2022 15:52:25 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EC712606 for ; Tue, 29 Nov 2022 12:52:24 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1p07aU-0001pO-QO; Tue, 29 Nov 2022 21:52:18 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 5/5] staging: r8188eu: simplify err handling for unknown station Date: Tue, 29 Nov 2022 21:51:52 +0100 Message-Id: <20221129205152.128172-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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-kernel@vger.kernel.org If we receive a disassoc message from an unknown station, we can drop this message immediately. Reorder the code to make this clearer. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index d5c9eb52fb0e..49e0b50b1243 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1435,6 +1435,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; + u8 updated = 0; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; @@ -1453,19 +1454,18 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) } psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - u8 updated = 0; - - spin_lock_bh(&pstapriv->asoc_list_lock); - if (!list_empty(&psta->asoc_list)) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, false, reason); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); + if (!psta) + return; - associated_clients_update(padapter, updated); + spin_lock_bh(&pstapriv->asoc_list_lock); + if (!list_empty(&psta->asoc_list)) { + list_del_init(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, false, reason); } + spin_unlock_bh(&pstapriv->asoc_list_lock); + + associated_clients_update(padapter, updated); } static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame) -- 2.30.2