From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v3 3/3] sae: fix inproper return value in sae_verify_accepted
Date: Mon, 21 Oct 2019 14:01:59 -0700 [thread overview]
Message-ID: <20191021210159.8132-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20191021210159.8132-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]
This function was returning a boolean and the expected return was
a signed integer. Since this function actually returned false in
all cases the check for a success (0) return always worked.
The comment about the 'standard code path' was removed as this is
no longer valid.
---
src/sae.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/sae.c b/src/sae.c
index a6b2c582..327277eb 100644
--- a/src/sae.c
+++ b/src/sae.c
@@ -935,7 +935,7 @@ static int sae_verify_confirmed(struct sae_sm *sm, uint16_t trans,
/*
* 802.11-2016 - 12.4.8.6.6 Protocol instance behavior - Accepted state
*/
-static bool sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
+static int sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
uint16_t status, const uint8_t *frame,
size_t len)
{
@@ -944,14 +944,14 @@ static bool sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
/* spec does not specify what to do here, so print and discard */
if (trans != SAE_STATE_CONFIRMED) {
l_error("received transaction %u in accepted state", trans);
- return false;
+ return -EBADMSG;
}
if (sm->sync > SAE_SYNC_MAX)
- return false;
+ return -EBADMSG;
if (len < 2)
- return false;
+ return -EBADMSG;
sc = l_get_le16(frame);
@@ -961,14 +961,14 @@ static bool sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
* silently discarded.
*/
if (sc <= sm->rc || sc == 0xffff)
- return false;
+ return -EBADMSG;
/*
* If the verification fails, the received frame shall be silently
* discarded.
*/
if (!sae_verify_confirm(sm, frame))
- return false;
+ return -EBADMSG;
/*
* If the verification succeeds, the Rc variable shall be set to the
@@ -981,11 +981,7 @@ static bool sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
sae_send_confirm(sm);
- /*
- * Since the confirmed needed special processing because of accepted
- * state we don't want the standard code path to execute.
- */
- return false;
+ return 0;
}
static int sae_verify_packet(struct sae_sm *sm, uint16_t trans,
--
2.17.1
next prev parent reply other threads:[~2019-10-21 21:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 21:01 [PATCH v3 1/3] mpdu: expose mmpdu_header_len James Prestwood
2019-10-21 21:01 ` [PATCH v3 2/3] sae: fix potential integer overflow James Prestwood
2019-10-21 21:01 ` James Prestwood [this message]
2019-10-21 21:51 ` [PATCH v3 1/3] mpdu: expose mmpdu_header_len 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=20191021210159.8132-3-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/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