Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp777517rwj; Sat, 29 Oct 2022 10:38:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x53d+Ngc8vcReCG9YRYHqsNL/nk5fAm6PtXQPvvCVC89eMsIhcrxJSiOPqEHW59rHhE5G X-Received: by 2002:a17:90a:558c:b0:213:8cf1:2ac2 with SMTP id c12-20020a17090a558c00b002138cf12ac2mr10505423pji.67.1667065084100; Sat, 29 Oct 2022 10:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667065084; cv=none; d=google.com; s=arc-20160816; b=VAg711keoJmKjhVtKjvxBFhbCxugSplBExxjVQjqdLQISQh8HGb4sviunnPIgBpz0U GbegFARYeYeXjpnCR9fF8SEY3mO3n25wv4uVzvW00MZjVxJGc/6uSl9r1kl/yahOX2zN HLYsZE6SOyTz/UaM3W+ZvIGRT8lkxDvL4S4Wzmcg6uBmpjXBFEdLRbHfi2gXkFW7JsVO 8dUHXrAp8ygKZ55w0REqXJ0LjczgLvCSVItPEIlcR++96pGZ3cCNeof3Vlf5rR/oiU6F gAZTntzJQxUvtDw7fptALBL3w+ZOEQoDKKtqMgBwswmpxTzJ37Eh21KPEqNFwHh6BYA2 VYPQ== 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=qj0geTIUZ48ZN8zquQpaUlsoZWi4UEsyJPupfn/E7bcHiomms1SVFUdwBy4XWBTJgd COLn4gEvnsFnN/7/uTWkgO1ew3RLsFqftIndhSDGzO0A46dnxHJbDA7r4r1svxzvbqf7 QvOAXdA21Two7D+uyx3Va/hIyYSwjj/vkYWLdWZADtJZog5xQn7exhwAQLac44RzM4bS lYOoN2P6mGaALi5X4qMLIkEJLb7CXcTbn9ypmHQdyEgipnMUuEi5gYAfhnk0Mwo/e/VL oVUU2nvrDhaCf2ByCoMcMxUDpENoYa0DEruCySKSd8qQaIyuaBzZzzHJROt6Oxe3tO8B lPUA== 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 u22-20020a056a00159600b0056c72071d3esi2977104pfk.235.2022.10.29.10.37.53; Sat, 29 Oct 2022 10:38:04 -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 S229880AbiJ2RYq (ORCPT + 99 others); Sat, 29 Oct 2022 13:24:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiJ2RYO (ORCPT ); Sat, 29 Oct 2022 13:24:14 -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 53E6152DFB for ; Sat, 29 Oct 2022 10:24:07 -0700 (PDT) Received: from dslb-188-097-213-253.188.097.pools.vodafone-ip.de ([188.97.213.253] 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 1oopYx-00074v-Qd; Sat, 29 Oct 2022 19:24:03 +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 13/13] staging: r8188eu: check destination address in OnAction Date: Sat, 29 Oct 2022 19:23:37 +0200 Message-Id: <20221029172337.1574593-14-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221029172337.1574593-1-martin@kaiser.cx> References: <20221029172337.1574593-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