3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-19 01:42:33 +01:00

station: fix crash if affinities watch gets removed

If the affinity watch is removed by setting an empty list the
disconnect callback won't be called which was the only place
the watch ID was cleared. This resulted in the next SetProperty call
to think a watch existed, and attempt to compare the sender address
which would be NULL.

The watch ID should be cleared inside the destroy callback, not
the disconnect callback.
This commit is contained in:
James Prestwood 2024-09-10 11:47:50 -07:00 committed by Denis Kenzior
parent 30cc3ecf7b
commit 4b2c6de45c

View File

@ -4601,7 +4601,6 @@ static void station_affinity_disconnected_cb(struct l_dbus *dbus,
struct station *station = user_data;
l_dbus_remove_watch(dbus_get_bus(), station->affinity_watch);
station->affinity_watch = 0;
l_debug("client that set affinity has disconnected");
@ -4614,6 +4613,8 @@ static void station_affinity_watch_destroy(void *user_data)
struct station *station = user_data;
bool empty = l_queue_length(station->affinities) == 0;
station->affinity_watch = 0;
l_free(station->affinity_client);
station->affinity_client = NULL;