* [PATCH] bluetooth:Fix error checking in the function sc_dhkey_check
@ 2015-08-19 1:47 Nicholas Krause
2015-08-24 10:03 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Krause @ 2015-08-19 1:47 UTC (permalink / raw)
To: marcel; +Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev,
linux-kernel
This fixes error checking in the function sc_dhkey_check by
properly checking if the internal call to the function smp_f6
has failed by returning a error code as we must return to the
caller immediately if this internal call fails as we cannot
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
net/bluetooth/smp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ad82324..05d9814 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1460,8 +1460,9 @@ static void sc_dhkey_check(struct smp_chan *smp)
if (smp->method == REQ_OOB)
memcpy(r, smp->rr, 16);
- smp_f6(smp->tfm_cmac, smp->mackey, smp->prnd, smp->rrnd, r, io_cap,
- local_addr, remote_addr, check.e);
+ if (smp_f6(smp->tfm_cmac, smp->mackey, smp->prnd, smp->rrnd, r, io_cap,
+ local_addr, remote_addr, check.e))
+ return;
smp_send_cmd(smp->conn, SMP_CMD_DHKEY_CHECK, sizeof(check), &check);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bluetooth:Fix error checking in the function sc_dhkey_check
2015-08-19 1:47 [PATCH] bluetooth:Fix error checking in the function sc_dhkey_check Nicholas Krause
@ 2015-08-24 10:03 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-08-24 10:03 UTC (permalink / raw)
To: Nicholas Krause; +Cc: linux-bluetooth
Hi Nicholas,
(unneeded recipients removed again)
On Tue, Aug 18, 2015, Nicholas Krause wrote:
> This fixes error checking in the function sc_dhkey_check by
> properly checking if the internal call to the function smp_f6
> has failed by returning a error code as we must return to the
> caller immediately if this internal call fails as we cannot
Looks like the last sentence above is incomplete.
> --- a/net/bluetooth/smp.c
> +++ b/net/bluetooth/smp.c
> @@ -1460,8 +1460,9 @@ static void sc_dhkey_check(struct smp_chan *smp)
> if (smp->method == REQ_OOB)
> memcpy(r, smp->rr, 16);
>
> - smp_f6(smp->tfm_cmac, smp->mackey, smp->prnd, smp->rrnd, r, io_cap,
> - local_addr, remote_addr, check.e);
> + if (smp_f6(smp->tfm_cmac, smp->mackey, smp->prnd, smp->rrnd, r, io_cap,
> + local_addr, remote_addr, check.e))
> + return;
This could cause the pairing procedure to get stuck because the remote
is expecting the DHKey Check PDU from us and instead we never send
anything. Probably the better solution is to make sc_dhkey_check()
return an SMP error and then pass that up the call stack if necessary,
similar to what sc_passkey_round() does.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-24 10:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 1:47 [PATCH] bluetooth:Fix error checking in the function sc_dhkey_check Nicholas Krause
2015-08-24 10:03 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).