From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 1/2] scan: fix invalid read when canceling an ongoing scan
Date: Wed, 24 Jul 2024 05:14:42 -0700 [thread overview]
Message-ID: <20240724121443.1425256-1-prestwoj@gmail.com> (raw)
When the survey code was added it neglected to add the same
cancelation logic that existed for the GET_SCAN call, i.e. if
a scan was canceled and there was a pending GET_SURVEY to the
kernel that needs to be canceled, and the request cleaned up.
Fixes: 35808debae ("scan: use GET_SURVEY for SNR calculation in ranking")
---
src/scan.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/scan.c b/src/scan.c
index 1982cf74..30b3361e 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -948,7 +948,7 @@ bool scan_cancel(uint64_t wdev_id, uint32_t id)
* Takes care of the following cases:
* 1. If TRIGGER_SCAN is in flight
* 2. TRIGGER_SCAN sent but bounced with -EBUSY
- * 3. Scan request is done but GET_SCAN is still pending
+ * 3. Scan request is done but GET_SCAN/GET_SURVEY is still pending
*
* For case 3, we can easily cancel the command and proceed with the
* other pending requests. For case 1 & 2, the subsequent pending
@@ -963,6 +963,9 @@ bool scan_cancel(uint64_t wdev_id, uint32_t id)
if (sc->start_cmd_id)
l_genl_family_cancel(nl80211, sc->start_cmd_id);
+ if (sc->get_survey_cmd_id)
+ l_genl_family_cancel(nl80211, sc->get_survey_cmd_id);
+
if (sc->get_scan_cmd_id)
l_genl_family_cancel(nl80211, sc->get_scan_cmd_id);
@@ -2105,7 +2108,10 @@ static void get_survey_done(void *user_data)
sc->get_survey_cmd_id = 0;
- get_results(results);
+ if (!results->sr->canceled)
+ get_results(results);
+ else
+ get_scan_done(user_data);
}
static bool scan_survey(struct scan_results *results)
--
2.34.1
next reply other threads:[~2024-07-24 12:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 12:14 James Prestwood [this message]
2024-07-24 12:14 ` [PATCH 2/2] auto-t: don't print valgrind log if there was no error James Prestwood
2024-07-24 14:14 ` [PATCH 1/2] scan: fix invalid read when canceling an ongoing scan Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2024-09-02 6:34 Daniel Bond
2024-09-03 11:44 ` James Prestwood
2024-09-03 17:03 ` Daniel Bond
2024-09-03 18:04 ` James Prestwood
2024-09-05 3:23 ` Denis Kenzior
2024-09-05 11:55 ` James Prestwood
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=20240724121443.1425256-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