Skip to contentSkip to conversation

netdev: fix segfault due to roaming before connected

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

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 netdev: 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 only sending RSSI events when netdev->operational is set rather than netdev->connected.

---
 src/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/netdev.c +1 -1
index 69f9ab85..b3c3bf73 100644
@@ -678,7 +678,7 @@ static void netdev_cqm_event_rssi_threshold(struct netdev *netdev,
 {
 	int event;
 
-	if (!netdev->connected)
+	if (!netdev->operational)
 		return;
 
 	if (rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW &&
Signature · 1 line
2.21.1
#1 lore raw

Hi James,

Quoted 8 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.

Quoted 5 lines

This can be avoided by only sending RSSI events when netdev->operational is set rather than netdev->connected.

---
  src/netdev.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

applied, thanks.

Regards,
-Denis