From patchwork Tue Nov 29 20:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567960wrr; Tue, 29 Nov 2022 13:07:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf48BPa0aFyH2PSnxy4Kwd81ZE9gGx96jhebZjxxLtM+FMJGcd38S0XECtIKjDHRF5aNNXA1 X-Received: by 2002:a17:902:aa04:b0:17f:6fee:3334 with SMTP id be4-20020a170902aa0400b0017f6fee3334mr39325029plb.10.1669756066059; Tue, 29 Nov 2022 13:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669756066; cv=none; d=google.com; s=arc-20160816; b=cyYbEyk/M6fHOS7RULewyA9t8Tu0KyaTEjfGF2Af6W31wLkfhA4EBQ1XQ2eG5niaRX qJuIPglkSeXSXHtwEcpNSsujUrkex0z4jc45WWkGqXf/2zSJJvtCdebJ3wIBd2ITYkt+ 5gJeycg2pRZL9yUBOJHq9sSU/3s9Cn62GQP++vSRkkHQIUW66MatfTCcXK/lh/x/Ywtb tL2+CpDPu5XMYCisHU+54MhLrdboiftRkvJ2K2e2w9LM2dPn6DFwW14yt6uf/49lpEn9 cMzZtkhngWzm7Oa91QYR3TwftMJ4y5D2DSqHnu+nYjmRcKYW47XK0flVRyla5hE4NxFG 2YBQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw1-20020a170903278100b00189380323f7si10426789plb.318.2022.11.29.13.07.30; Tue, 29 Nov 2022 13:07:46 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750866136686619471?= X-GMAIL-MSGID: =?utf-8?q?1750866136686619471?= 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)