Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Will Dietz <w@wdtz.org>
To: iwd@lists.01.org
Subject: [PATCH] station: don't reset/(re)configure/destroy NULL netconfig's
Date: Thu, 03 Oct 2019 11:43:50 -0500	[thread overview]
Message-ID: <20191003114350.GE8802@dtznix> (raw)

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

Fixes crashes when `enable_network_config` is false (default).

---
 src/station.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/station.c b/src/station.c
index eed3a7f..9b3e087 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1165,16 +1165,18 @@ static void station_enter_state(struct station *station,
 		periodic_scan_stop(station);
 
 		if (station->state == STATION_STATE_ROAMING) {
-			netconfig_reconfigure(station->netconfig);
+			if (station->netconfig)
+				netconfig_reconfigure(station->netconfig);
 
 			break;
 		}
 
-		netconfig_configure(station->netconfig,
-					network_get_settings(
-						station->connected_network),
-					netdev_get_address(
-							station->netdev));
+		if (station->netconfig)
+			netconfig_configure(station->netconfig,
+						network_get_settings(
+							station->connected_network),
+						netdev_get_address(
+								station->netdev));
 		break;
 	case STATION_STATE_DISCONNECTING:
 	case STATION_STATE_ROAMING:
@@ -1262,7 +1264,8 @@ static void station_disassociated(struct station *station)
 {
 	l_debug("%u", netdev_get_ifindex(station->netdev));
 
-	netconfig_reset(station->netconfig);
+	if (station->netconfig)
+		netconfig_reset(station->netconfig);
 
 	station_reset_connection_state(station);
 
@@ -2344,7 +2347,8 @@ static void station_disconnect_onconnect(struct station *station,
 		return;
 	}
 
-	netconfig_reset(station->netconfig);
+	if (station->netconfig)
+		netconfig_reset(station->netconfig);
 
 	station_reset_connection_state(station);
 
@@ -2581,7 +2585,8 @@ int station_disconnect(struct station *station)
 					station_disconnect_cb, station) < 0)
 		return -EIO;
 
-	netconfig_reset(station->netconfig);
+	if (station->netconfig)
+		netconfig_reset(station->netconfig);
 
 	/*
 	 * If the disconnect somehow fails we won't know if we're still
@@ -3061,7 +3066,8 @@ static void station_free(struct station *station)
 	if (station->connected_bss)
 		netdev_disconnect(station->netdev, NULL, NULL);
 
-	netconfig_destroy(station->netconfig);
+	if (station->netconfig)
+		netconfig_destroy(station->netconfig);
 	station->netconfig = NULL;
 
 	periodic_scan_stop(station);
-- 
2.23.GIT

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2019-10-03 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 16:43 Will Dietz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-03 17:24 [PATCH] station: don't reset/(re)configure/destroy NULL netconfig's Will Dietz
2019-10-03 17:35 ` Denis Kenzior

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=20191003114350.GE8802@dtznix \
    --to=w@wdtz.org \
    --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