wifi: rtw89: fix potential leak in rtw89_append_probe_req_ie()
authorZong-Zhe Yang <kevin_yang@realtek.com>
Tue, 3 Jan 2023 14:10:54 +0000 (22:10 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 16 Jan 2023 13:35:21 +0000 (15:35 +0200)
Do `kfree_skb(new)` before `goto out` to prevent potential leak.

Fixes: 895907779752 ("rtw89: 8852a: add ieee80211_ops::hw_scan")
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230103141054.17372-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/fw.c

index 19a49ef243fa4d98f42b4f946e2b069f0198597d..98cfadda8f45e867fc5b255cee64dbd38fd0e867 100644 (file)
@@ -2686,8 +2686,10 @@ static int rtw89_append_probe_req_ie(struct rtw89_dev *rtwdev,
 
                list_add_tail(&info->list, &scan_info->pkt_list[band]);
                ret = rtw89_fw_h2c_add_pkt_offload(rtwdev, &info->id, new);
-               if (ret)
+               if (ret) {
+                       kfree_skb(new);
                        goto out;
+               }
 
                kfree_skb(new);
        }