From: Suchir Kavi <suchirkavi@gmail.com>
To: iwd@lists.linux.dev
Subject: [PATCH 3/3] station: fix NULL deref in ap_directed_roam
Date: Wed, 15 Jul 2026 19:34:44 -0700 [thread overview]
Message-ID: <20260716023444.3512595-4-suchirkavi@gmail.com> (raw)
In-Reply-To: <20260716023444.3512595-1-suchirkavi@gmail.com>
station_ap_directed_roam() initialized ignore_candidates from
station->connected_bss->vendor_quirks before the state != CONNECTED
guard. station_disconnect() clears connected_bss before entering
DISCONNECTING and the WNM frame watch outlives the connection, so a BSS
Transition Management frame arriving in that window crashes on the
dereference the guard was meant to prevent.
Assign it after the state check, which guarantees connected_bss is set
(the frame-sanitize memcmp below already relies on the same invariant).
Assisted-by: Claude:claude-fable-5
---
src/station.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/station.c b/src/station.c
index 0b2d7dc6..e3aeb3fd 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3273,8 +3273,7 @@ static void station_ap_directed_roam(struct station *station,
uint16_t dtimer;
uint8_t valid_interval;
bool can_roam = !station_cannot_roam(station);
- bool ignore_candidates =
- station->connected_bss->vendor_quirks.ignore_bss_tm_candidates;
+ bool ignore_candidates;
l_debug("ifindex: %u", netdev_get_ifindex(station->netdev));
@@ -3283,6 +3282,9 @@ static void station_ap_directed_roam(struct station *station,
return;
}
+ ignore_candidates =
+ station->connected_bss->vendor_quirks.ignore_bss_tm_candidates;
+
/*
* Sanitize the frame to check that it is from our current AP.
*
--
2.54.0
prev parent reply other threads:[~2026-07-16 2:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 2:34 [PATCH 0/3] Fix two station roaming crashes Suchir Kavi
2026-07-16 2:34 ` [PATCH 1/3] station: fix use-after-free in preauthenticate_cb Suchir Kavi
2026-07-16 2:34 ` [PATCH 2/3] netdev: reject reassociation while connect pending Suchir Kavi
2026-07-16 2:34 ` Suchir Kavi [this message]
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=20260716023444.3512595-4-suchirkavi@gmail.com \
--to=suchirkavi@gmail.com \
--cc=iwd@lists.linux.dev \
/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