All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] network: handle NULL/hotspot networks when removing secrets
@ 2021-08-18 21:50 James Prestwood
  2021-08-18 21:50 ` [PATCH v2 2/4] hwsim: add Rule.remove_all() James Prestwood
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Prestwood @ 2021-08-18 21:50 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

The hotspot case can actually result in network being NULL which
ends up crashing when accessing "->secrets". In addition any
secrets on this network were never removed for hotspot networks
since everything happened in network_unset_hotspot.
---
 src/network.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/network.c b/src/network.c
index 79f3bd33..d81a201d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1823,6 +1823,9 @@ static void network_unset_hotspot(struct network *network, void *user_data)
 		return;
 
 	network_set_info(network, NULL);
+
+	l_queue_destroy(network->secrets, eap_secret_info_free);
+	network->secrets = NULL;
 }
 
 static void emit_known_network_removed(struct station *station, void *user_data)
@@ -1841,6 +1844,9 @@ static void emit_known_network_removed(struct station *station, void *user_data)
 			return;
 
 		network_set_info(network, NULL);
+
+		l_queue_destroy(network->secrets, eap_secret_info_free);
+		network->secrets = NULL;
 	}
 
 	connected_network = station_get_connected_network(station);
@@ -1849,9 +1855,6 @@ static void emit_known_network_removed(struct station *station, void *user_data)
 
 	if (network && was_hidden)
 		station_hide_network(station, network);
-
-	l_queue_destroy(network->secrets, eap_secret_info_free);
-	network->secrets = NULL;
 }
 
 static void network_update_hotspot(struct network *network, void *user_data)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-18 21:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-18 21:50 [PATCH v2 1/4] network: handle NULL/hotspot networks when removing secrets James Prestwood
2021-08-18 21:50 ` [PATCH v2 2/4] hwsim: add Rule.remove_all() James Prestwood
2021-08-18 21:50 ` [PATCH v2 3/4] auto-t: fix error handling in testHotspot James Prestwood
2021-08-18 21:50 ` [PATCH v2 4/4] test-runner: fix subtest option James Prestwood
2021-08-18 21:58 ` [PATCH v2 1/4] network: handle NULL/hotspot networks when removing secrets Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.