casaroli commented on code in PR #21341:
URL: https://github.com/apache/nuttx/pull/21341#discussion_r4440962605
##########
drivers/net/wifi_sim.c:
##########
@@ -1992,9 +2011,10 @@ void wifi_sim_remove(FAR struct wifi_sim_lowerhalf_s
*netdev)
if (sta && sta->state == WLAN_STA_STATE_CONNECTED)
{
- wifidriver_start_disconnect(sta);
+ wifidriver_start_disconnect(sta);
}
+ nxmutex_destroy(&sta->ap_lock);
Review Comment:
`nxmutex_destroy(&sta->ap_lock)` also runs when `sta` is NULL.
`virtio_net_remove()` calls `wifi_sim_remove()` for every virtio-net device,
and the Ethernet ones (after `CONFIG_WIFI_SIM_NUMBER`) have no `wifi`, so
removing one now dereferences NULL (before, it was only `kmm_free(NULL)`).
Fix: return early in `wifi_sim_remove()` when `sta` is NULL, before the
disconnect and `nxmutex_destroy()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]