From: Ping-Ke Shih <pkshih@realtek.com>
To: <tony0620emma@gmail.com>, <kvalo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>, <usama.anjum@collabora.com>,
<phhuang@realtek.com>
Subject: [PATCH 1/3] rtw88: check for validity before using a pointer
Date: Fri, 21 Jan 2022 15:08:11 +0800 [thread overview]
Message-ID: <20220121070813.9656-2-pkshih@realtek.com> (raw)
In-Reply-To: <20220121070813.9656-1-pkshih@realtek.com>
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
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: 10d162b2ed39 ("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>
---
drivers/net/wireless/realtek/rtw88/fw.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 2f7c036f90221..b56dc43229d28 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -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,
--
2.25.1
next prev parent reply other threads:[~2022-01-21 7:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 7:08 [PATCH 0/3] rtw88: some fixes of hw_scan Ping-Ke Shih
2022-01-21 7:08 ` Ping-Ke Shih [this message]
2022-01-31 15:47 ` [PATCH 1/3] rtw88: check for validity before using a pointer Kalle Valo
2022-01-21 7:08 ` [PATCH 2/3] rtw88: fix idle mode flow for hw scan Ping-Ke Shih
2022-01-21 7:08 ` [PATCH 3/3] rtw88: fix memory overrun and memory leak during hw_scan Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220121070813.9656-2-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=phhuang@realtek.com \
--cc=tony0620emma@gmail.com \
--cc=usama.anjum@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).