diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-11-13 07:37:47 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-14 19:53:27 -0500 |
commit | 970d0f1b280372cfd46b6de5529d96f8448de943 (patch) | |
tree | 5c851219000bb94098fc2edca1561eaca617b170 /net/bluetooth/smp.c | |
parent | 3e64b7bd8234b459134b3059919828122e2fd79f (diff) |
Bluetooth: Convert LTK list to RCU
This patch set converts the hdev->long_term_keys list to use RCU to
eliminate the need to use hci_dev_lock/unlock.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 3dc5f0e66405..fd2dfe5222bc 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -383,13 +383,13 @@ static void smp_chan_destroy(struct l2cap_conn *conn) | |||
383 | /* If pairing failed clean up any keys we might have */ | 383 | /* If pairing failed clean up any keys we might have */ |
384 | if (!complete) { | 384 | if (!complete) { |
385 | if (smp->ltk) { | 385 | if (smp->ltk) { |
386 | list_del(&smp->ltk->list); | 386 | list_del_rcu(&smp->ltk->list); |
387 | kfree(smp->ltk); | 387 | kfree_rcu(smp->ltk, rcu); |
388 | } | 388 | } |
389 | 389 | ||
390 | if (smp->slave_ltk) { | 390 | if (smp->slave_ltk) { |
391 | list_del(&smp->slave_ltk->list); | 391 | list_del_rcu(&smp->slave_ltk->list); |
392 | kfree(smp->slave_ltk); | 392 | kfree_rcu(smp->slave_ltk, rcu); |
393 | } | 393 | } |
394 | 394 | ||
395 | if (smp->remote_irk) { | 395 | if (smp->remote_irk) { |
@@ -1321,7 +1321,6 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1321 | 1321 | ||
1322 | skb_pull(skb, sizeof(*rp)); | 1322 | skb_pull(skb, sizeof(*rp)); |
1323 | 1323 | ||
1324 | hci_dev_lock(hdev); | ||
1325 | authenticated = (hcon->sec_level == BT_SECURITY_HIGH); | 1324 | authenticated = (hcon->sec_level == BT_SECURITY_HIGH); |
1326 | ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK, | 1325 | ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK, |
1327 | authenticated, smp->tk, smp->enc_key_size, | 1326 | authenticated, smp->tk, smp->enc_key_size, |
@@ -1329,7 +1328,6 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1329 | smp->ltk = ltk; | 1328 | smp->ltk = ltk; |
1330 | if (!(smp->remote_key_dist & KEY_DIST_MASK)) | 1329 | if (!(smp->remote_key_dist & KEY_DIST_MASK)) |
1331 | smp_distribute_keys(smp); | 1330 | smp_distribute_keys(smp); |
1332 | hci_dev_unlock(hdev); | ||
1333 | 1331 | ||
1334 | return 0; | 1332 | return 0; |
1335 | } | 1333 | } |