staging: r8188eu: check destination address in OnAction
authorMartin Kaiser <martin@kaiser.cx>
Sun, 30 Oct 2022 17:33:26 +0000 (18:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Oct 2022 08:09:05 +0000 (09:09 +0100)
All subfunctions of OnAction check if the destination address matches the
local interface's address. It's simpler to move this check to OnAction.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221030173326.1588647-14-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c

index 93f3d38..e985fc5 100644 (file)
@@ -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);