Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp2064286rwj; Sun, 30 Oct 2022 10:37:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7n4wvVGin7MO+nNbZwfYzWFf4QRwIIdtm4wiGX8An5WzqMNPA0ALQdOMAh4fPjxujsBTlM X-Received: by 2002:a17:906:5a49:b0:7ad:d063:901a with SMTP id my9-20020a1709065a4900b007add063901amr1679348ejc.323.1667151430361; Sun, 30 Oct 2022 10:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151430; cv=none; d=google.com; s=arc-20160816; b=F0LNJr+SR14UkMKJlCa0VryGzKvqVsaAFHXWuYIpm1N6su/IEQGc3LDbhPrn993f91 zTWSzvbE2LFv8b9nkw5hH5oaUD428nKoPiJifdc4GO3NWlQ1MJlmOXmCQyniZcXn4pEq cEpaZXwR8x5VzYmgBqwElk3TrXyKGazzvGDsktySL2LEASjvgUNDXHG8fAXWtbaTufSE JOcwqI52v6hzbfGcqzsKmSYEq6u4dfdsHZgXEJ4K3Ip6MAWhQOSwGyBb8M5OMuRX/R2s BA3CLVnjDKWdQdF3mwdXYaBSBXLApyo6HzVqaadEbbo3DzTDzlTVFEbwOf43VdykUIAq XZaQ== 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 Return-Path: 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.36.45; Sun, 30 Oct 2022 10:37:10 -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 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 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); -- 2.30.2