]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
rtw88: wow: fix size access error of probe request
authorChin-Yen Lee <timlee@realtek.com>
Wed, 28 Jul 2021 01:43:35 +0000 (09:43 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 5 Nov 2021 09:18:42 +0000 (10:18 +0100)
BugLink: https://bugs.launchpad.net/bugs/1947781
[ Upstream commit 69c7044526d984df672b8d9b6d6998c34617cde4 ]

Current flow will lead to null ptr access because of trying
to get the size of freed probe-request packets. We store the
information of packet size into rsvd page instead and also fix
the size error issue, which will cause unstable behavoir of
sending probe request by wow firmware.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210728014335.8785-6-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/wireless/realtek/rtw88/fw.c
drivers/net/wireless/realtek/rtw88/fw.h

index 6649b84f6b1e471797d3733823fa151a3e772759..609f721ef4cfa0355c11ec39b6275ec7ff4d7be7 100644 (file)
@@ -688,7 +688,7 @@ static u16 rtw_get_rsvd_page_probe_req_size(struct rtw_dev *rtwdev,
                        continue;
                if ((!ssid && !rsvd_pkt->ssid) ||
                    rtw_ssid_equal(rsvd_pkt->ssid, ssid))
-                       size = rsvd_pkt->skb->len;
+                       size = rsvd_pkt->probe_req_size;
        }
 
        return size;
@@ -916,6 +916,8 @@ static struct sk_buff *rtw_get_rsvd_page_skb(struct ieee80211_hw *hw,
                                                         ssid->ssid_len, 0);
                else
                        skb_new = ieee80211_probereq_get(hw, vif->addr, NULL, 0, 0);
+               if (skb_new)
+                       rsvd_pkt->probe_req_size = (u16)skb_new->len;
                break;
        case RSVD_NLO_INFO:
                skb_new = rtw_nlo_info_get(hw);
@@ -1512,6 +1514,7 @@ int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,
 static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size,
                                u8 location)
 {
+       struct rtw_chip_info *chip = rtwdev->chip;
        u8 h2c_pkt[H2C_PKT_SIZE] = {0};
        u16 total_size = H2C_PKT_HDR_SIZE + H2C_PKT_UPDATE_PKT_LEN;
 
@@ -1522,6 +1525,7 @@ static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size,
        UPDATE_PKT_SET_LOCATION(h2c_pkt, location);
 
        /* include txdesc size */
+       size += chip->tx_pkt_desc_sz;
        UPDATE_PKT_SET_SIZE(h2c_pkt, size);
 
        rtw_fw_send_h2c_packet(rtwdev, h2c_pkt);
@@ -1531,7 +1535,7 @@ void rtw_fw_update_pkt_probe_req(struct rtw_dev *rtwdev,
                                 struct cfg80211_ssid *ssid)
 {
        u8 loc;
-       u32 size;
+       u16 size;
 
        loc = rtw_get_rsvd_page_probe_req_location(rtwdev, ssid);
        if (!loc) {
index 39c905c1b1d85db7d4cb76832dd9c327dfec8dec..198bf94587a546db92c10e87e851a8ac8abf7275 100644 (file)
@@ -126,6 +126,7 @@ struct rtw_rsvd_page {
        u8 page;
        bool add_txdesc;
        struct cfg80211_ssid *ssid;
+       u16 probe_req_size;
 };
 
 enum rtw_keep_alive_pkt_type {