Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 1/4] network: handle NULL/hotspot networks when removing secrets
Date: Wed, 18 Aug 2021 10:26:00 -0700	[thread overview]
Message-ID: <20210818172603.266294-1-prestwoj@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1323 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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index 79f3bd33..b794e609 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1823,6 +1823,11 @@ static void network_unset_hotspot(struct network *network, void *user_data)
 		return;
 
 	network_set_info(network, NULL);
+
+	if (network->secrets) {
+		l_queue_destroy(network->secrets, eap_secret_info_free);
+		network->secrets = NULL;
+	}
 }
 
 static void emit_known_network_removed(struct station *station, void *user_data)
@@ -1850,8 +1855,10 @@ 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;
+	if (network && network->secrets) {
+		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

             reply	other threads:[~2021-08-18 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 17:26 James Prestwood [this message]
2021-08-18 17:26 ` [PATCH 2/4] hwsim: add Rule.remove_all() James Prestwood
2021-08-18 17:26 ` [PATCH 3/4] auto-t: fix error handling in testHotspot James Prestwood
2021-08-18 17:26 ` [PATCH 4/4] test-runner: fix subtest option James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210818172603.266294-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox