Skip to contentSkip to conversation

station: fix segfault due to roaming before connected

PATCH Superseded James Prestwood 2 participants 2 messages May 4, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 station: fix segfault due to roaming before connected

In this situation the kernel is sending a low RSSI event which netdev picks up, but since we set netdev->connected so early the event is forwarded to station before IWD has fully connected. Station then tries to get a neighbor report, which may fail and cause a known frequency scan. If this is a new network the frequency scan tries to get any known frequencies in network_info which will be unset and cause a segfault.

This can be avoided by ensuring that we are connected inside station_cannot_roam() rather than checking that we aren't roaming. This modification will ensure both connected and not roaming before doing a roam.

---
 src/station.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/station.c +1 -1
index c532319a..5b0e7fd4 100644
@@ -2007,7 +2007,7 @@ static bool station_cannot_roam(struct station *station)
 		disabled = false;
 
 	return disabled || station->preparing_roam ||
-					station->state == STATION_STATE_ROAMING;
+				station->state != STATION_STATE_CONNECTED;
 }
 
 static void station_lost_beacon(struct station *station)
Signature · 1 line
2.21.1
#1 lore raw

Hi James,

Quoted 7 lines · James Prestwood

In this situation the kernel is sending a low RSSI event which netdev picks up, but since we set netdev->connected so early the event is forwarded to station before IWD has fully connected. Station then tries to get a neighbor report, which may fail and cause a known frequency scan. If this is a new network the frequency scan tries to get any known frequencies in network_info which will be unset and cause a segfault.

Hmm, maybe netdev should not send any RSSI events until netdev->operational is true instead.

Regards,
-Denis