Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v3 1/7] wiphy: track GET_REG ID
Date: Thu,  4 Aug 2022 11:51:06 -0700	[thread overview]
Message-ID: <20220804185112.457670-1-prestwoj@gmail.com> (raw)

Keep track of the GET_REG call so it can be canceled if the wiphy
goes down.
---
 src/wiphy.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

v3:
 * Moved this out into its own patch

diff --git a/src/wiphy.c b/src/wiphy.c
index 8cb9eb39..30b860da 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -121,6 +121,7 @@ struct wiphy {
 	/* Work queue for this radio */
 	struct l_queue *work;
 	bool work_in_callback;
+	unsigned int get_reg_id;
 
 	bool support_scheduled_scan:1;
 	bool support_rekey_offload:1;
@@ -341,6 +342,9 @@ static void wiphy_free(void *data)
 
 	l_debug("Freeing wiphy %s[%u]", wiphy->name, wiphy->id);
 
+	if (wiphy->get_reg_id)
+		l_genl_family_cancel(nl80211, wiphy->get_reg_id);
+
 	for (i = 0; i < NUM_NL80211_IFTYPES; i++)
 		l_free(wiphy->iftype_extended_capabilities[i]);
 
@@ -1875,6 +1879,8 @@ static void wiphy_get_reg_cb(struct l_genl_msg *msg, void *user_data)
 	uint32_t tmp;
 	bool global;
 
+	wiphy->get_reg_id = 0;
+
 	/*
 	 * NL80211_CMD_GET_REG contains an NL80211_ATTR_WIPHY iff the wiphy
 	 * uses a self-managed regulatory domain.
@@ -1892,8 +1898,9 @@ static void wiphy_get_reg_domain(struct wiphy *wiphy)
 	msg = l_genl_msg_new(NL80211_CMD_GET_REG);
 	l_genl_msg_append_attr(msg, NL80211_ATTR_WIPHY, 4, &wiphy->id);
 
-	if (!l_genl_family_send(wiphy->nl80211, msg, wiphy_get_reg_cb, wiphy,
-				NULL)) {
+	wiphy->get_reg_id = l_genl_family_send(wiphy->nl80211, msg,
+						wiphy_get_reg_cb, wiphy, NULL);
+	if (!wiphy->get_reg_id) {
 		l_error("Error sending NL80211_CMD_GET_REG for %s", wiphy->name);
 		l_genl_msg_unref(msg);
 	}
-- 
2.34.3


             reply	other threads:[~2022-08-04 18:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 18:51 James Prestwood [this message]
2022-08-04 18:51 ` [PATCH v3 2/7] wiphy: dump wiphy's on regulatory domain change James Prestwood
2022-08-04 18:51 ` [PATCH v3 3/7] wiphy: add wiphy_regdom_is_updating James Prestwood
2022-08-04 18:51 ` [PATCH v3 4/7] station: do full passive scan if 6GHz is supported but disabled James Prestwood
2022-08-04 19:20   ` Denis Kenzior
2022-08-04 18:51 ` [PATCH v3 5/7] scan: split full scans by band to enable 6GHz James Prestwood
2022-08-04 18:51 ` [PATCH v3 6/7] scan: watch for regdom updates " James Prestwood
2022-08-04 18:51 ` [PATCH v3 7/7] wiphy: don't re-dump wiphy if the regdom didn't change James Prestwood
2022-08-04 19:18 ` [PATCH v3 1/7] wiphy: track GET_REG ID 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=20220804185112.457670-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /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