Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 1/4] test-runner: fix crash if ofono is not installed
Date: Mon, 16 Mar 2020 12:22:39 -0700	[thread overview]
Message-ID: <20200316192242.15588-1-prestwoj@gmail.com> (raw)

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

The goto was jumping to a label which freed the wiphy list which
had not yet been initialized. This also fixes another similar issue
if chdir fails (in this case tmpfs_extra_stuff would get freed
before being allocated).
---
 tools/test-runner.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 804a1038..42bd60e2 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2073,7 +2073,7 @@ static void create_network_and_run_tests(void *data, void *user_data)
 	if (chdir(config_dir_path) < 0) {
 		l_error("Failed to change to test directory: %s",
 							strerror(errno));
-		goto exit_hwsim;
+		goto free_hw_settings;
 	}
 
 	tmpfs_extra_stuff =
@@ -2097,7 +2097,7 @@ static void create_network_and_run_tests(void *data, void *user_data)
 
 			if (!ofono_found || !phonesim_found) {
 				l_info("ofono or phonesim not found, skipping");
-				goto exit_hwsim;
+				goto free_tmpfs_extra;
 			}
 
 			ofono_req = true;
@@ -2268,7 +2268,6 @@ exit_hostapd:
 remove_abs_paths:
 	remove_absolute_path_dirs(tmpfs_extra_stuff);
 
-exit_hwsim:
 	/*
 	 * If running in hwsim mode, we want to completely free/destroy the
 	 * wiphy list since it will be re-populated on the next test. For the
@@ -2280,8 +2279,10 @@ exit_hwsim:
 	else
 		l_queue_foreach(wiphy_list, wiphy_reset, NULL);
 
-	l_settings_free(hw_settings);
+free_tmpfs_extra:
 	l_strfreev(tmpfs_extra_stuff);
+free_hw_settings:
+	l_settings_free(hw_settings);
 }
 
 struct stat_totals {
-- 
2.21.1

             reply	other threads:[~2020-03-16 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 19:22 James Prestwood [this message]
2020-03-16 19:22 ` [PATCH 2/4] test-runner: fix crash for tests using radius_server James Prestwood
2020-03-16 19:22 ` [PATCH 3/4] test-runner: fix improper loading of radius_config James Prestwood
2020-03-16 19:22 ` [PATCH 4/4] netdev: fix auth protocols not setting ->connected James Prestwood
2020-03-16 20:22 ` [PATCH 1/4] test-runner: fix crash if ofono is not installed 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=20200316192242.15588-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