From: Johan Hedberg Date: Fri, 14 Mar 2014 08:53:50 +0000 (+0200) Subject: Bluetooth: Fix updating SMP remote key distribution information X-Git-Tag: v4.9.8~6025^2~11^2~7^2~45^2~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdcc4beccb52f752799978c4da0dcd0faadbdcd4;p=platform%2Fkernel%2Flinux-rpi3.git Bluetooth: Fix updating SMP remote key distribution information When performing pairing using SMP the remote may clear any key distribution bits it wants in its pairing response. We must therefore update our local variable accordingly, otherwise we might get stuck waiting for keys that will never come. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 74a17cf..8a1b1bf 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -748,6 +748,11 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) smp->prsp[0] = SMP_CMD_PAIRING_RSP; memcpy(&smp->prsp[1], rsp, sizeof(*rsp)); + /* Update remote key distribution in case the remote cleared + * some bits that we had enabled in our request. + */ + smp->remote_key_dist &= rsp->resp_key_dist; + if ((req->auth_req & SMP_AUTH_BONDING) && (rsp->auth_req & SMP_AUTH_BONDING)) auth = SMP_AUTH_BONDING;