mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_wifi: netif: set interface before registering Wi-Fi driver RX callback
If appropriate interface is not set then RX callback can potentially dereference null pointer from `s_wifi_netifs` table. This in-fact resulted in `LoadProhibited` exception in HTTP server example test case. Order here for setting interface and then registering callback was correct but it was modified in 0e71a325de309400b68f018da7df52f1890c57ba causing this regression.
This commit is contained in:
parent
8417079218
commit
f45dbd1f97
@ -133,10 +133,13 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* Interface must be set before registering Wi-Fi RX callback */
|
||||
set_wifi_netif(wifi_interface, esp_netif_get_netif_impl(arg));
|
||||
|
||||
if ((ret = esp_wifi_internal_reg_rxcb(wifi_interface, rxcb)) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "esp_wifi_internal_reg_rxcb for if=%d failed with %d", wifi_interface, ret);
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
set_wifi_netif(wifi_interface, esp_netif_get_netif_impl(arg));
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user