diff mbox series

[v3,1/7] wiphy: track GET_REG ID

Message ID 20220804185112.457670-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v3,1/7] wiphy: track GET_REG ID | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-alpine-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Aug. 4, 2022, 6:51 p.m. UTC
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

Comments

Denis Kenzior Aug. 4, 2022, 7:18 p.m. UTC | #1
Hi James,

On 8/4/22 13:51, James Prestwood wrote:
> 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
> 

Patch 1,2,3 and 7 applied, thanks.

Regards,
-Denis
diff mbox series

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);
 	}