3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-04 02:18:49 +02:00

netdev: Better detect connecting state

netdev_free relies on netdev->connected being set to detect whether a
connection is in progress.  This variable is only set once the driver
has been connected however, so for situations where a CMD_CONNECT is
still 'in flight' or if the wiphy work is still pending, the ongoing
connection will not be canceled.  Fix that by being more thorough when
trying to detect that a connection is in progress.

src/wiphy.c:wiphy_radio_work_next() Starting work item 2
Terminate
src/netdev.c:netdev_free() Freeing netdev wlan0[9]
src/device.c:device_free()
src/station.c:station_free()
src/netconfig.c:netconfig_destroy()
Removing scan context for wdev c
src/scan.c:scan_context_free() sc: 0x4a44c80
src/netdev.c:netdev_mlme_notify() MLME notification New Station(19)
src/netdev.c:netdev_link_notify() event 16 on ifindex 9
==6356== Invalid write of size 4
==6356==    at 0x40A253: netdev_cmd_connect_cb (netdev.c:2522)
==6356==    by 0x4A8886: process_unicast (genl.c:986)
==6356==    by 0x4A8C48: received_data (genl.c:1098)
==6356==    by 0x4A3DFD: io_callback (io.c:120)
==6356==    by 0x4A2799: l_main_iterate (main.c:478)
==6356==    by 0x4A28DA: l_main_run (main.c:525)
==6356==    by 0x4A2BF2: l_main_run_with_signal (main.c:647)
==6356==    by 0x404D27: main (main.c:542)
==6356==  Address 0x4a3e418 is 152 bytes inside a block of size 472 free'd
==6356==    at 0x48399CB: free (vg_replace_malloc.c:538)
==6356==    by 0x49996F: l_free (util.c:136)
==6356==    by 0x406662: netdev_free (netdev.c:886)
==6356==    by 0x4129C2: netdev_shutdown (netdev.c:5980)
==6356==    by 0x403A14: iwd_shutdown (main.c:79)
==6356==    by 0x403A7D: signal_handler (main.c:90)
==6356==    by 0x4A2AFB: sigint_handler (main.c:612)
==6356==    by 0x4A2F3B: handle_callback (signal.c:78)
==6356==    by 0x4A3030: signalfd_read_cb (signal.c:104)
==6356==    by 0x4A3DFD: io_callback (io.c:120)
==6356==    by 0x4A2799: l_main_iterate (main.c:478)
==6356==    by 0x4A28DA: l_main_run (main.c:525)
==6356==  Block was alloc'd at
==6356==    at 0x483879F: malloc (vg_replace_malloc.c:307)
==6356==    by 0x49983B: l_malloc (util.c:62)
==6356==    by 0x4121BD: netdev_create_from_genl (netdev.c:5776)
==6356==    by 0x451F6F: manager_new_station_interface_cb (manager.c:173)
==6356==    by 0x4A8886: process_unicast (genl.c:986)
==6356==    by 0x4A8C48: received_data (genl.c:1098)
==6356==    by 0x4A3DFD: io_callback (io.c:120)
==6356==    by 0x4A2799: l_main_iterate (main.c:478)
==6356==    by 0x4A28DA: l_main_run (main.c:525)
==6356==    by 0x4A2BF2: l_main_run_with_signal (main.c:647)
==6356==    by 0x404D27: main (main.c:542)
This commit is contained in:
Denis Kenzior 2021-06-01 18:16:03 -05:00
parent 683ff1a4e4
commit 77ea7ad437

View File

@ -815,7 +815,7 @@ static void netdev_free(void *data)
l_timeout_remove(netdev->neighbor_report_timeout);
}
if (netdev->connected)
if (netdev->connected || netdev->connect_cmd_id || netdev->work.id)
netdev_connect_free(netdev);
if (netdev->disconnect_cmd_id) {