public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v4 2/2] netdev: fix potential command ID overwrite setting CQM threshold
Date: Tue,  3 Sep 2024 11:06:53 -0700	[thread overview]
Message-ID: <20240903180653.205405-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20240903180653.205405-1-prestwoj@gmail.com>

With the introduction of affinities the CQM threshold can be toggled
by a DBus call. There was no check if there was already a pending
call which would cause the command ID to be overwritten and lose any
potential to cancel it, e.g. if netdev went down.
---
 src/netdev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c
index 14fe41b4..d95a2a1e 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -3715,6 +3715,9 @@ static int netdev_cqm_rssi_update(struct netdev *netdev)
 
 	l_debug("");
 
+	if (netdev->set_cqm_cmd_id)
+		return -EBUSY;
+
 	if (!wiphy_has_ext_feature(netdev->wiphy,
 					NL80211_EXT_FEATURE_CQM_RSSI_LIST))
 		msg = netdev_build_cmd_cqm_rssi_update(netdev, NULL, 0);
@@ -3752,9 +3755,7 @@ static int netdev_set_signal_thresholds(struct netdev *netdev, int threshold,
 	netdev->low_signal_threshold = threshold;
 	netdev->low_signal_threshold_5ghz = threshold_5ghz;
 
-	netdev_cqm_rssi_update(netdev);
-
-	return 0;
+	return netdev_cqm_rssi_update(netdev);
 }
 
 int netdev_lower_signal_threshold(struct netdev *netdev)
-- 
2.34.1


  reply	other threads:[~2024-09-03 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 18:06 [PATCH v4 1/2] netdev: fall back to RSSI polling if SET_CQM fails James Prestwood
2024-09-03 18:06 ` James Prestwood [this message]
2024-09-05  3:26 ` 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=20240903180653.205405-2-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