* [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk()
@ 2023-10-04 14:37 Igor Artemiev
2023-10-04 14:58 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Igor Artemiev @ 2023-10-04 14:37 UTC (permalink / raw)
To: Johannes Berg
Cc: Igor Artemiev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-wireless, netdev, linux-kernel, lvc-project
If 'idx' is 0, then 'idx2' is -1, and arrays
will be accessed by a negative index.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
---
net/mac80211/rx.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index e751cda5eef6..e686380434bd 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1868,10 +1868,13 @@ ieee80211_rx_get_bigtk(struct ieee80211_rx_data *rx, int idx)
key = rcu_dereference(rx->link_sta->gtk[idx]);
if (!key)
key = rcu_dereference(rx->link->gtk[idx]);
- if (!key && rx->link_sta)
- key = rcu_dereference(rx->link_sta->gtk[idx2]);
- if (!key)
- key = rcu_dereference(rx->link->gtk[idx2]);
+
+ if (idx2 >= 0) {
+ if (!key && rx->link_sta)
+ key = rcu_dereference(rx->link_sta->gtk[idx2]);
+ if (!key)
+ key = rcu_dereference(rx->link->gtk[idx2]);
+ }
return key;
}
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk()
2023-10-04 14:37 [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk() Igor Artemiev
@ 2023-10-04 14:58 ` Johannes Berg
2023-10-05 12:31 ` Igor A. Artemiev
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2023-10-04 14:58 UTC (permalink / raw)
To: Igor Artemiev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-wireless, netdev, linux-kernel, lvc-project
On Wed, 2023-10-04 at 17:37 +0300, Igor Artemiev wrote:
> If 'idx' is 0
And ... how exactly do you propose that is going to happen?
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk()
2023-10-04 14:58 ` Johannes Berg
@ 2023-10-05 12:31 ` Igor A. Artemiev
0 siblings, 0 replies; 3+ messages in thread
From: Igor A. Artemiev @ 2023-10-05 12:31 UTC (permalink / raw)
To: Johannes Berg
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-wireless, netdev, linux-kernel, lvc-project
On 10/4/23 17:58, Johannes Berg wrote:
> And ... how exactly do you propose that is going to happen?
'conf.keyidx', the value that is passed to the function, can be 0. But I
missed checking the second argument of the ieee80211_rx_get_bigtk()
function before calling it. Sorry to bother you.
Thanks,
Igor
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-05 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 14:37 [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk() Igor Artemiev
2023-10-04 14:58 ` Johannes Berg
2023-10-05 12:31 ` Igor A. Artemiev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®