From nobody Sat Jan 3 04:16:53 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9746FE7C4C4 for ; Wed, 4 Oct 2023 14:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242811AbjJDOi6 (ORCPT ); Wed, 4 Oct 2023 10:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbjJDOiz (ORCPT ); Wed, 4 Oct 2023 10:38:55 -0400 Received: from tretyak2.mcst.ru (tretyak2.mcst.ru [212.5.119.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A9BDC0 for ; Wed, 4 Oct 2023 07:38:49 -0700 (PDT) Received: from tretyak2.mcst.ru (localhost [127.0.0.1]) by tretyak2.mcst.ru (Postfix) with ESMTP id 514B1102397; Wed, 4 Oct 2023 17:38:45 +0300 (MSK) Received: from frog.lab.sun.mcst.ru (frog.lab.sun.mcst.ru [176.16.4.50]) by tretyak2.mcst.ru (Postfix) with ESMTP id 4BB9D102395; Wed, 4 Oct 2023 17:38:00 +0300 (MSK) Received: from artemiev-i.lab.sun.mcst.ru (avior-1 [192.168.63.223]) by frog.lab.sun.mcst.ru (8.13.4/8.12.11) with ESMTP id 394Ebxp3003157; Wed, 4 Oct 2023 17:37:59 +0300 From: Igor Artemiev To: Johannes Berg Cc: Igor Artemiev , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [lvc-project] [PATCH] wifi: mac80211: fix buffer overflow in ieee80211_rx_get_bigtk() Date: Wed, 4 Oct 2023 17:37:40 +0300 Message-Id: <20231004143740.40933-1-Igor.A.Artemiev@mcst.ru> X-Mailer: git-send-email 2.39.0.152.ga5737674b6 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.39/RELEASE, bases: 20111107 #2745587, check: 20231004 notchecked X-AV-Checked: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If 'idx' is 0, then 'idx2' is -1, and arrays=20 will be accessed by a negative index.=20 Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Igor Artemiev --- 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 =3D rcu_dereference(rx->link_sta->gtk[idx]); if (!key) key =3D rcu_dereference(rx->link->gtk[idx]); - if (!key && rx->link_sta) - key =3D rcu_dereference(rx->link_sta->gtk[idx2]); - if (!key) - key =3D rcu_dereference(rx->link->gtk[idx2]); + + if (idx2 >=3D 0) { + if (!key && rx->link_sta) + key =3D rcu_dereference(rx->link_sta->gtk[idx2]); + if (!key) + key =3D rcu_dereference(rx->link->gtk[idx2]); + } =20 return key; } --=20 2.30.2