* [PATCH net] wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan
@ 2024-06-23 8:49 Jeongjun Park
2024-06-25 11:54 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Jeongjun Park @ 2024-06-23 8:49 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, netdev, linux-kernel
In the process of searching for matching hardware channels, wreq and
wreq->num_channels are checked to see if they are NULL. However,
if the value of wreq->num_channels is greater than IW_MAX_FREQUENCIES,
an out-of-bounds vulnerability occurs.
Therefore, you must also add code to check whether the value of
wreq->num_channels is within the range.
Reguards.
Signed-by-off: Jeongjun Park <aha310510@gmail.com>
---
net/wireless/scan.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 0222ede0feb6..f253dee041d1 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3460,6 +3460,10 @@ int cfg80211_wext_siwscan(struct net_device *dev,
if (wreq && wreq->num_channels) {
int k;
int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
+
+ if (wreq->num_channels > IW_MAX_FREQUENCIES)
+ wreq->num_channels = IW_MAX_FREQUENCIES;
+
for (k = 0; k < wreq->num_channels; k++) {
struct iw_freq *freq =
&wreq->channel_list[k];
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan
2024-06-23 8:49 [PATCH net] wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan Jeongjun Park
@ 2024-06-25 11:54 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2024-06-25 11:54 UTC (permalink / raw)
To: Jeongjun Park; +Cc: linux-wireless, netdev, linux-kernel
On Sun, 2024-06-23 at 17:49 +0900, Jeongjun Park wrote:
> In the process of searching for matching hardware channels, wreq and
> wreq->num_channels are checked to see if they are NULL. However,
> if the value of wreq->num_channels is greater than IW_MAX_FREQUENCIES,
> an out-of-bounds vulnerability occurs.
>
> Therefore, you must also add code to check whether the value of
> wreq->num_channels is within the range.
>
This is the same more or less as
https://msgid.link/20240531032010.451295-1-dmantipov@yandex.ru
no?
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-25 11:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-23 8:49 [PATCH net] wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan Jeongjun Park
2024-06-25 11:54 ` Johannes Berg
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).