Commit eed467b5 authored by Howard Chung's avatar Howard Chung Committed by Marcel Holtmann

Bluetooth: fix passkey uninitialized when used

This patch fix the issue: warning:variable 'passkey' is uninitialized
when used here

Link: https://groups.google.com/forum/#!topic/clang-built-linux/kyRKCjRsGoU

Fixes: cee5f20f ("Bluetooth: secure bluetooth stack from bluedump attack")
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Suggested-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarHoward Chung <howardchung@google.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 1c22d3cd
...@@ -2115,7 +2115,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2115,7 +2115,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
struct l2cap_chan *chan = conn->smp; struct l2cap_chan *chan = conn->smp;
struct smp_chan *smp = chan->data; struct smp_chan *smp = chan->data;
struct hci_conn *hcon = conn->hcon; struct hci_conn *hcon = conn->hcon;
u8 *pkax, *pkbx, *na, *nb; u8 *pkax, *pkbx, *na, *nb, confirm_hint;
u32 passkey; u32 passkey;
int err; int err;
...@@ -2179,13 +2179,12 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2179,13 +2179,12 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
*/ */
if (hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, if (hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
hcon->role)) { hcon->role)) {
err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, /* Set passkey to 0. The value can be any number since
hcon->type, * it'll be ignored anyway.
hcon->dst_type, */
passkey, 1); passkey = 0;
if (err) confirm_hint = 1;
return SMP_UNSPECIFIED; goto confirm;
set_bit(SMP_FLAG_WAIT_USER, &smp->flags);
} }
} }
...@@ -2207,8 +2206,11 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2207,8 +2206,11 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
if (err) if (err)
return SMP_UNSPECIFIED; return SMP_UNSPECIFIED;
confirm_hint = 0;
confirm:
err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type, err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type,
hcon->dst_type, passkey, 0); hcon->dst_type, passkey, confirm_hint);
if (err) if (err)
return SMP_UNSPECIFIED; return SMP_UNSPECIFIED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment