station: fix segfault due to roaming before connected
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
@@ -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
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->connectedso 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 innetwork_infowhich will be unset and cause a segfault.
Hmm, maybe netdev should not send any RSSI events until netdev->operational is true instead.
Regards,
-Denis