Commit bffb9b51 authored by David S. Miller's avatar David S. Miller

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth

Johan Hedberg says:

====================
pull request: bluetooth 2018-09-13

A few Bluetooth fixes for the 4.19-rc series:

 - Fixed rw_semaphore leak in hci_ldisc
 - Fixed local Out-of-Band pairing data handling

Let me know if there are any issues pulling. Thanks.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 79140335 e6a57d22
...@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) ...@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty)
} }
clear_bit(HCI_UART_PROTO_SET, &hu->flags); clear_bit(HCI_UART_PROTO_SET, &hu->flags);
percpu_free_rwsem(&hu->proto_lock);
kfree(hu); kfree(hu);
} }
......
...@@ -83,6 +83,7 @@ enum { ...@@ -83,6 +83,7 @@ enum {
struct smp_dev { struct smp_dev {
/* Secure Connections OOB data */ /* Secure Connections OOB data */
bool local_oob;
u8 local_pk[64]; u8 local_pk[64];
u8 local_rand[16]; u8 local_rand[16];
bool debug_key; bool debug_key;
...@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) ...@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16])
memcpy(rand, smp->local_rand, 16); memcpy(rand, smp->local_rand, 16);
smp->local_oob = true;
return 0; return 0;
} }
...@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the * successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use. * flag to indicate that local OOB is in use.
*/ */
if (req->oob_flag == SMP_OOB_PRESENT) if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
/* SMP over BR/EDR requires special treatment */ /* SMP over BR/EDR requires special treatment */
...@@ -1967,7 +1970,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1967,7 +1970,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the * successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use. * flag to indicate that local OOB is in use.
*/ */
if (rsp->oob_flag == SMP_OOB_PRESENT) if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
smp->prsp[0] = SMP_CMD_PAIRING_RSP; smp->prsp[0] = SMP_CMD_PAIRING_RSP;
...@@ -2697,7 +2700,13 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2697,7 +2700,13 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)
* key was set/generated. * key was set/generated.
*/ */
if (test_bit(SMP_FLAG_LOCAL_OOB, &smp->flags)) { if (test_bit(SMP_FLAG_LOCAL_OOB, &smp->flags)) {
struct smp_dev *smp_dev = chan->data; struct l2cap_chan *hchan = hdev->smp_data;
struct smp_dev *smp_dev;
if (!hchan || !hchan->data)
return SMP_UNSPECIFIED;
smp_dev = hchan->data;
tfm_ecdh = smp_dev->tfm_ecdh; tfm_ecdh = smp_dev->tfm_ecdh;
} else { } else {
...@@ -3230,6 +3239,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) ...@@ -3230,6 +3239,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
return ERR_CAST(tfm_ecdh); return ERR_CAST(tfm_ecdh);
} }
smp->local_oob = false;
smp->tfm_aes = tfm_aes; smp->tfm_aes = tfm_aes;
smp->tfm_cmac = tfm_cmac; smp->tfm_cmac = tfm_cmac;
smp->tfm_ecdh = tfm_ecdh; smp->tfm_ecdh = tfm_ecdh;
......
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