Skip to content

Commit

Permalink
rtw88: check for validity before using a pointer
Browse files Browse the repository at this point in the history
[ Upstream commit a12f809 ]

ieee80211_probereq_get() can return NULL. Pointer skb should be checked
for validty before use. If it is not valid, list of skbs needs to be
freed.

Fixes: 10d162b ("rtw88: 8822c: add ieee80211_ops::hw_scan")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121070813.9656-2-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
musamaanjum authored and gregkh committed Apr 8, 2022
1 parent e1b5ddc commit 487e8f6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/wireless/realtek/rtw88/fw.c
Expand Up @@ -1866,11 +1866,19 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev,
req->ssids[i].ssid,
req->ssids[i].ssid_len,
req->ie_len);
if (!skb)
goto out;
rtw_append_probe_req_ie(rtwdev, skb, &list, rtwvif);
kfree_skb(skb);
}

return _rtw_hw_scan_update_probe_req(rtwdev, num, &list);

out:
skb_queue_walk(&list, skb)
kfree_skb(skb);

return -ENOMEM;
}

static int rtw_add_chan_info(struct rtw_dev *rtwdev, struct rtw_chan_info *info,
Expand Down

0 comments on commit 487e8f6

Please sign in to comment.