3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

station: don't reset/(re)configure/destroy NULL netconfig's

Fixes crashes when `enable_network_config` is false (default).
This commit is contained in:
Will Dietz 2019-10-03 12:24:09 -05:00 committed by Denis Kenzior
parent 6672bc2a37
commit 44ae6a46da

View File

@ -1165,16 +1165,18 @@ static void station_enter_state(struct station *station,
periodic_scan_stop(station); periodic_scan_stop(station);
if (station->state == STATION_STATE_ROAMING) { if (station->state == STATION_STATE_ROAMING) {
netconfig_reconfigure(station->netconfig); if (station->netconfig)
netconfig_reconfigure(station->netconfig);
break; break;
} }
netconfig_configure(station->netconfig, if (station->netconfig)
network_get_settings( netconfig_configure(station->netconfig,
station->connected_network), network_get_settings(
netdev_get_address( station->connected_network),
station->netdev)); netdev_get_address(
station->netdev));
break; break;
case STATION_STATE_DISCONNECTING: case STATION_STATE_DISCONNECTING:
case STATION_STATE_ROAMING: case STATION_STATE_ROAMING:
@ -1262,7 +1264,8 @@ static void station_disassociated(struct station *station)
{ {
l_debug("%u", netdev_get_ifindex(station->netdev)); l_debug("%u", netdev_get_ifindex(station->netdev));
netconfig_reset(station->netconfig); if (station->netconfig)
netconfig_reset(station->netconfig);
station_reset_connection_state(station); station_reset_connection_state(station);
@ -2344,7 +2347,8 @@ static void station_disconnect_onconnect(struct station *station,
return; return;
} }
netconfig_reset(station->netconfig); if (station->netconfig)
netconfig_reset(station->netconfig);
station_reset_connection_state(station); station_reset_connection_state(station);
@ -2581,7 +2585,8 @@ int station_disconnect(struct station *station)
station_disconnect_cb, station) < 0) station_disconnect_cb, station) < 0)
return -EIO; return -EIO;
netconfig_reset(station->netconfig); if (station->netconfig)
netconfig_reset(station->netconfig);
/* /*
* If the disconnect somehow fails we won't know if we're still * If the disconnect somehow fails we won't know if we're still
@ -3061,7 +3066,8 @@ static void station_free(struct station *station)
if (station->connected_bss) if (station->connected_bss)
netdev_disconnect(station->netdev, NULL, NULL); netdev_disconnect(station->netdev, NULL, NULL);
netconfig_destroy(station->netconfig); if (station->netconfig)
netconfig_destroy(station->netconfig);
station->netconfig = NULL; station->netconfig = NULL;
periodic_scan_stop(station); periodic_scan_stop(station);