diff options
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 2 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 963bb0309e25..ea6238ed5c0e 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) | |||
543 | } | 543 | } |
544 | clear_bit(HCI_UART_PROTO_SET, &hu->flags); | 544 | clear_bit(HCI_UART_PROTO_SET, &hu->flags); |
545 | 545 | ||
546 | percpu_free_rwsem(&hu->proto_lock); | ||
547 | |||
546 | kfree(hu); | 548 | kfree(hu); |
547 | } | 549 | } |
548 | 550 | ||
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index ae91e2d40056..3a7b0773536b 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -83,6 +83,7 @@ enum { | |||
83 | 83 | ||
84 | struct smp_dev { | 84 | struct smp_dev { |
85 | /* Secure Connections OOB data */ | 85 | /* Secure Connections OOB data */ |
86 | bool local_oob; | ||
86 | u8 local_pk[64]; | 87 | u8 local_pk[64]; |
87 | u8 local_rand[16]; | 88 | u8 local_rand[16]; |
88 | bool debug_key; | 89 | bool debug_key; |
@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) | |||
599 | 600 | ||
600 | memcpy(rand, smp->local_rand, 16); | 601 | memcpy(rand, smp->local_rand, 16); |
601 | 602 | ||
603 | smp->local_oob = true; | ||
604 | |||
602 | return 0; | 605 | return 0; |
603 | } | 606 | } |
604 | 607 | ||
@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1785 | * successfully received our local OOB data - therefore set the | 1788 | * successfully received our local OOB data - therefore set the |
1786 | * flag to indicate that local OOB is in use. | 1789 | * flag to indicate that local OOB is in use. |
1787 | */ | 1790 | */ |
1788 | if (req->oob_flag == SMP_OOB_PRESENT) | 1791 | if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob) |
1789 | set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); | 1792 | set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); |
1790 | 1793 | ||
1791 | /* SMP over BR/EDR requires special treatment */ | 1794 | /* 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 | * successfully received our local OOB data - therefore set the | 1970 | * successfully received our local OOB data - therefore set the |
1968 | * flag to indicate that local OOB is in use. | 1971 | * flag to indicate that local OOB is in use. |
1969 | */ | 1972 | */ |
1970 | if (rsp->oob_flag == SMP_OOB_PRESENT) | 1973 | if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob) |
1971 | set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); | 1974 | set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); |
1972 | 1975 | ||
1973 | smp->prsp[0] = SMP_CMD_PAIRING_RSP; | 1976 | 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 | * key was set/generated. | 2700 | * key was set/generated. |
2698 | */ | 2701 | */ |
2699 | if (test_bit(SMP_FLAG_LOCAL_OOB, &smp->flags)) { | 2702 | if (test_bit(SMP_FLAG_LOCAL_OOB, &smp->flags)) { |
2700 | struct smp_dev *smp_dev = chan->data; | 2703 | struct l2cap_chan *hchan = hdev->smp_data; |
2704 | struct smp_dev *smp_dev; | ||
2705 | |||
2706 | if (!hchan || !hchan->data) | ||
2707 | return SMP_UNSPECIFIED; | ||
2708 | |||
2709 | smp_dev = hchan->data; | ||
2701 | 2710 | ||
2702 | tfm_ecdh = smp_dev->tfm_ecdh; | 2711 | tfm_ecdh = smp_dev->tfm_ecdh; |
2703 | } else { | 2712 | } else { |
@@ -3230,6 +3239,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) | |||
3230 | return ERR_CAST(tfm_ecdh); | 3239 | return ERR_CAST(tfm_ecdh); |
3231 | } | 3240 | } |
3232 | 3241 | ||
3242 | smp->local_oob = false; | ||
3233 | smp->tfm_aes = tfm_aes; | 3243 | smp->tfm_aes = tfm_aes; |
3234 | smp->tfm_cmac = tfm_cmac; | 3244 | smp->tfm_cmac = tfm_cmac; |
3235 | smp->tfm_ecdh = tfm_ecdh; | 3245 | smp->tfm_ecdh = tfm_ecdh; |