mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adi Prasan <itsadi2409@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, linux-kernel@vger.kernel.org,
	Adi Prasan <itsadi2409@gmail.com>,
	syzbot+847847e76c6983a5b3dd@syzkaller.appspotmail.com
Subject: [PATCH] wifi: mac80211_hwsim: handle invalid tx rate index
Date: Fri, 18 Sep 2026 03:47:17 +0000	[thread overview]
Message-ID: <20260918034717.22104-1-itsadi2409@gmail.com> (raw)

mac80211_hwsim_get_tx_rate() calls ieee80211_get_tx_rate()
without checking whether the rate index is valid.

A monitor frame with an invalid or missing legacy rate can leave
rates[0].idx set to -1. This triggers the WARN_ON_ONCE() in
ieee80211_get_tx_rate().

Treat a negative rate index like the existing MCS/VHT case and
return NULL. The caller already handles a missing tx rate.

Reported-by: syzbot+847847e76c6983a5b3dd@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=847847e76c6983a5b3dd
Signed-off-by: Adi Prasan <itsadi2409@gmail.com>
---
 drivers/net/wireless/virtual/mac80211_hwsim_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 02b6d81cccd1..e7bf91e06e40 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -1332,6 +1332,9 @@ mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
 	    (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
 		return NULL;
 
+	if (info->control.rates[0].idx < 0)
+		return NULL;
+
 	return ieee80211_get_tx_rate(hw, info);
 }
 
-- 
2.43.0


                 reply	other threads:[~2026-09-18  3:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260918034717.22104-1-itsadi2409@gmail.com \
    --to=itsadi2409@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=syzbot+847847e76c6983a5b3dd@syzkaller.appspotmail.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

all inboxes | Powered by JetHome®