From patchwork Sun Oct 30 17:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894160wru; Sun, 30 Oct 2022 10:36:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75/FyNFQT2GeJMef4MeSgLzo6AhbdSmwAn9xEIUD330kN0kBrlJDQA92eOKjaMHCHSwl5v X-Received: by 2002:a05:6402:1cc5:b0:453:ed3f:6a38 with SMTP id ds5-20020a0564021cc500b00453ed3f6a38mr9857175edb.346.1667151381351; Sun, 30 Oct 2022 10:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151381; cv=none; d=google.com; s=arc-20160816; b=TCRxhddGNqdgfz89hwDsPG21Vq/bRqvsF9caxm6AKVi6egCCLfQJku2lFQzpfYXsUf XpCGGpti2+nW/nLI//L+G7cJJ1MyK5oljXbpKm5FZCJz3fH0okpxWgjxT1ZNrF72W+6y cXxuqg7NMOsM6nXizmVFCktphscld++3SwaXZ8Nd/A84D25LHXZPDfLqJB9zpTgkl4SU Sq22fFFQeM14HPlqIJgnIXYHzgxT3rh9zfnIMCpoc4wbgFZKb4OmAg0KPYw9MUO0l1g6 DU0iqJPx9VVKBKkV1hs0p9QH5woTSLlmaxuYd7GcRjGj6Ma9oqJhxlWFAXG4fcN24Shw 8YBg== 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=XEEr+6ilrEHWzb8gusSS9Q9Fm4iEeIJnwWVdTU4i58Y=; b=lUXGDaV541MzmPYmEc7hgswwhW/wzZzWfBXmacE0S9+gdJ2in5hj9ZFBWO3SiR4G7P +S9YBbGHN2hWphEm101mvBUxtky00RPMJRWWYVZsKysVM20K1+B7W1jJ4VBpObb9Suax bKIOJ2mJpJcYUTO02XoM8xmgTqnpRIY4Xyh6biPyXv7NCz85CXFqGtdjP6iVee49M54D gAlWd0nQeIc6scBae+FXMKWsdYhzRLJbLzO9lOCOqqtCzwL9UBg+aATJzHAelk8ZMkLW ZvOYRSYCsE94YpNraVhyjCQo7u6mIr1qaY/kESr/OTvBAZX0FcupZc28jWM+eH8jET9l uDCA== 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 p11-20020a056402500b00b00459563e2c60si5461426eda.329.2022.10.30.10.35.57; Sun, 30 Oct 2022 10:36:21 -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 S230010AbiJ3Rec (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiJ3Rdy (ORCPT ); Sun, 30 Oct 2022 13:33:54 -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 2BD9DA465 for ; Sun, 30 Oct 2022 10:33:54 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBz-000469-45; Sun, 30 Oct 2022 18:33:51 +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 v2 13/13] staging: r8188eu: check destination address in OnAction Date: Sun, 30 Oct 2022 18:33:26 +0100 Message-Id: <20221030173326.1588647-14-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-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?1748134926744792634?= X-GMAIL-MSGID: =?utf-8?q?1748134926744792634?= All subfunctions of OnAction check if the destination address matches the local interface's address. It's simpler to move this check to OnAction. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 93f3d387e92d..e985fc5fc575 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1492,9 +1492,6 @@ static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_fra struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 *pframe = precv_frame->rx_data; struct sta_priv *pstapriv = &padapter->stapriv; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ - return; if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) @@ -3795,10 +3792,6 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) - return; - /* All members of the action enum start with action_code. */ if (mgmt->u.action.u.s1g.action_code == WLAN_PUB_ACTION_VENDOR_SPECIFIC) on_action_public_vendor(precv_frame); @@ -3808,17 +3801,12 @@ static void on_action_public(struct adapter *padapter, struct recv_frame *precv_ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame) { - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; u8 *frame_body; u8 OUI_Subtype; u8 *pframe = precv_frame->rx_data; uint len = precv_frame->len; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - /* check RA matches or not */ - if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))/* for if1, sta/ap mode */ - return; - frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); if (be32_to_cpu(*((__be32 *)(frame_body + 1))) != P2POUI) @@ -3835,6 +3823,9 @@ static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; + if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) + return; + switch (mgmt->u.action.category) { case WLAN_CATEGORY_BACK: OnAction_back(padapter, precv_frame);