From patchwork Sat Oct 15 15:24:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 2955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp683855wrs; Sat, 15 Oct 2022 08:26:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7alXQeaXuI/B9su38jL1mslfc2SxUQn9oeyOd7mnVhC+Lt3w2gfm7OK6xcGb+fOpbgj84z X-Received: by 2002:a17:90a:e291:b0:20a:acde:1c43 with SMTP id d17-20020a17090ae29100b0020aacde1c43mr3948996pjz.62.1665847578227; Sat, 15 Oct 2022 08:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665847578; cv=none; d=google.com; s=arc-20160816; b=CQzSjJX7fjSducuO/qTLS6azGeraVtvY3TJ3m3jgKSrYMGnJfNffa0jl0YJ09Zqgqi qWIcJC5nPBbYJotZEhZDbJ21rouq2CKizV78SEGac50jwC5JkYJ7nF4jre+vIlBEyRoL DiXaEwDEl3/eApaPsSn1O93Y6CBjUpRalvW8n1C5YEcKkwglRjef2x+2bsgM0YncQ8jE hbJxuC0eBCvLtydARo/leW6+Lni/aotb64/05nnnMNuERA/Ae/6US6BgqexTCUXy+tXg HIS/ML8VC0SCk6yWZOxegqfOjFbQ9aEG5v3Bi3yOiUzxwVqIhHEHAuDiasEADV1X09jv yRqg== 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=pQjsJp6id7u0oojWfZhKZK0A70u/JRdAN34BpTJ5H5U=; b=dEqUg7Rjuv+Zcqd5YGmbvUw/6oFkTBDJ8Bzfcw0hKqqqhsc7TYpsl4PqI3+5uHC0GN afSfXsRFRCQwAzfhNZsPpvhkbBuS0TcTMdxsBFJKBkbSCTYouJ7J/e0Y3xzs/TXDa2S2 p9FyySmyjBfgOYsF+95HehDE7qvHVMxxy1RJO/MbBQlLQKt6F3lPQDMWl7c0pJMN0q0T Iu2tWZMahyJSynsXk82yGMMYSVNO6UvWm0TEA6wBvcB2DAmrJV+ySGKNgOdMt08qnHke jqUBrgyxBxIs7QZmla7j1yZxMgvwjtDE9K7l7D+jvnhsJwW5EMGQVpJYdeB9LAebZ8Uh bNPw== 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 jj5-20020a170903048500b00179f69eae64si6637214plb.620.2022.10.15.08.26.03; Sat, 15 Oct 2022 08:26:18 -0700 (PDT) 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 S229673AbiJOPZI (ORCPT + 99 others); Sat, 15 Oct 2022 11:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbiJOPZF (ORCPT ); Sat, 15 Oct 2022 11:25:05 -0400 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 A8034175B8 for ; Sat, 15 Oct 2022 08:24:57 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] 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 1ojj1x-000722-Ra; Sat, 15 Oct 2022 17:24:53 +0200 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 6/9] staging: r8188eu: exit for deauth from unknown station Date: Sat, 15 Oct 2022 17:24:37 +0200 Message-Id: <20221015152440.232281-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015152440.232281-1-martin@kaiser.cx> References: <20221015152440.232281-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?1746767790340954708?= X-GMAIL-MSGID: =?utf-8?q?1746767790340954708?= If we receive a deauth message from an unknown station, we can drop this message and exit immediately. Reorder the code to make this clearer, don't wrap everything in an if statement. 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 742976c38cd5..40df0f9982f4 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1477,21 +1477,21 @@ unsigned int OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; + u8 updated = 0; 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 _SUCCESS; - 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); return _SUCCESS; } else {