rtw89_fw_h2c_update_beacon() and rtw89_fw_h2c_update_beacon_be() cast the sk_buff pointer itself to struct ieee80211_hdr to compute the TIM offset: hdr = (struct ieee80211_hdr *)skb_beacon; The 802.11 header lives in the frame data returned by ieee80211_beacon_get_tim(), not at the start of struct sk_buff, so the cast reads sk_buff metadata instead of frame_control. For a freshly allocated skb skb->next is NULL, the value read is 0 and ieee80211_hdrlen() happens to return the same 24 bytes as a real beacon header, which masks the bug. As soon as the skb is on a list the computed header length is garbage and the Group IE offset passed to the firmware is wrong. Point hdr at skb_beacon->data instead. Found by code inspection; not observed at runtime. Signed-off-by: Shirong Zhao --- drivers/net/wireless/realtek/rtw89/fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 21b548c..0eab77f 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -5130,7 +5130,7 @@ int rtw89_fw_h2c_update_beacon(struct rtw89_dev *rtwdev, skb_put_data(skb_beacon, noa_data, noa_len); } - hdr = (struct ieee80211_hdr *)skb_beacon; + hdr = (struct ieee80211_hdr *)skb_beacon->data; tim_offset -= ieee80211_hdrlen(hdr->frame_control); bcn_total_len = len + skb_beacon->len; @@ -5209,7 +5209,7 @@ int rtw89_fw_h2c_update_beacon_be(struct rtw89_dev *rtwdev, skb_put_data(skb_beacon, noa_data, noa_len); } - hdr = (struct ieee80211_hdr *)skb_beacon; + hdr = (struct ieee80211_hdr *)skb_beacon->data; tim_offset -= ieee80211_hdrlen(hdr->frame_control); bcn_total_len = len + skb_beacon->len;