scan: fix invalid read when canceling an ongoing scan
PATCH 1/2 scan: fix invalid read when canceling an ongoing scan
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.
--- src/scan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
src/scan.c +8 -2
@@ -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)
Signature · 1 line
2.34.1
PATCH 2/2 auto-t: don't print valgrind log if there was no error
If valgrind didn't report any issues, don't dump the logs. This makes the test run a lot easier to look at without having to scroll through pages of valgrind logs that provide no value.
--- tools/run-tests | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
tools/run-tests +11 -5
@@ -899,12 +899,18 @@ def post_test(ctx, to_copy): if ctx.args.valgrind: for f in os.listdir('/tmp'): - if f.startswith("valgrind.log."): - dbg(f) - with open('/tmp/' + f, 'r') as v: - dbg(v.read()) + if not f.startswith("valgrind.log."): + continue + + with open('/tmp/' + f, 'r') as v: + result = v.read() + + # Don't print out the result if there were no issues + if "0 errors from 0 contexts" not in result: + dbg(result) dbg("\n") - os.remove('/tmp/' + f) + + os.remove('/tmp/' + f) # Special case for when logging is enabled if os.path.isfile('/tmp/iwd-tls-debug-server-cert.pem'):
Signature · 1 line
2.34.1
Hi James,
Quoted 10 lines · James Prestwood
When the survey code was added it neglected to add the same cancelation logic that existed for the
GET_SCANcall, i.e. if a scan was canceled and there was a pendingGET_SURVEYto 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(-)
Both applied, thanks.
Regards,
-Denis