From: Martin Kaiser Date: Sun, 3 Apr 2022 16:54:37 +0000 (+0200) Subject: staging: r8188eu: don't call get_hdr_bssid X-Git-Tag: v6.6.17~7348^2~253 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a074dc8145eabd09413c6e68e3f978ab0f37b4f;p=platform%2Fkernel%2Flinux-rpi.git staging: r8188eu: don't call get_hdr_bssid Do not call get_hdr_bssid from validate_recv_data_frame. We already distinguish between the four cases for to_ds, from_ds. Copy the bssid address as described in the "DS bit usage" table in include/linux/ieee80211.h. Eventually, we should remove get_hdr_bssid (and other similar driver-specific parsing functions). Signed-off-by: Martin Kaiser Link: https://lore.kernel.org/r/20220403165438.357728-11-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 63ce664..e920978 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -937,7 +937,6 @@ static int validate_recv_data_frame(struct adapter *adapter, struct recv_frame *precv_frame) { u8 bretry; - u8 *pbssid; struct sta_info *psta = NULL; u8 *ptr = precv_frame->rx_data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data; @@ -947,15 +946,9 @@ static int validate_recv_data_frame(struct adapter *adapter, bretry = ieee80211_has_retry(hdr->frame_control); - pbssid = get_hdr_bssid(ptr); - if (!pbssid) - return _FAIL; - memcpy(pattrib->dst, ieee80211_get_DA(hdr), ETH_ALEN); memcpy(pattrib->src, ieee80211_get_SA(hdr), ETH_ALEN); - memcpy(pattrib->bssid, pbssid, ETH_ALEN); - /* address4 is used only if both to_ds and from_ds are set */ if (ieee80211_has_a4(hdr->frame_control)) return _FAIL; @@ -963,12 +956,16 @@ static int validate_recv_data_frame(struct adapter *adapter, memcpy(pattrib->ra, hdr->addr1, ETH_ALEN); memcpy(pattrib->ta, hdr->addr2, ETH_ALEN); - if (ieee80211_has_fromds(hdr->frame_control)) + if (ieee80211_has_fromds(hdr->frame_control)) { + memcpy(pattrib->bssid, hdr->addr2, ETH_ALEN); ret = ap2sta_data_frame(adapter, precv_frame, &psta); - else if (ieee80211_has_tods(hdr->frame_control)) + } else if (ieee80211_has_tods(hdr->frame_control)) { + memcpy(pattrib->bssid, hdr->addr1, ETH_ALEN); ret = sta2ap_data_frame(adapter, precv_frame, &psta); - else + } else { + memcpy(pattrib->bssid, hdr->addr3, ETH_ALEN); ret = sta2sta_data_frame(adapter, precv_frame, &psta); + } if (ret == _FAIL || ret == RTW_RX_HANDLED) return ret;