drivers: wifi: esp_at: fix deadlock in socket close path
This fixes deadlock in socket close path. In the scenario:
1. on_cmd_ipd/esp_socket_rx invokes esp_socket_ref_from_link_id
and increments refcount.
2. zvfs_close/esp_put locks cond.lock.
3. zvfs_close/esp_put waits on sem_free.
4. on_cmd_ipd/esp_socket_rx waits on cond.lock before esp_socket_unref.
5. sem_free waits on esp_socket_unref for refcount reaching zero.
As we detect socket is closing, we can ignore last rx data and escape
from the trap.
Signed-off-by:
Chun-Chieh Li <ccli8@nuvoton.com>
Loading
Please sign in to comment