diff options
-rw-r--r-- | net/bluetooth/smp.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 795c603bed30..0b4403f3dce1 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -46,7 +46,6 @@ enum { | |||
46 | struct smp_chan { | 46 | struct smp_chan { |
47 | struct l2cap_conn *conn; | 47 | struct l2cap_conn *conn; |
48 | struct delayed_work security_timer; | 48 | struct delayed_work security_timer; |
49 | struct work_struct distribute_work; | ||
50 | 49 | ||
51 | u8 preq[7]; /* SMP Pairing Request */ | 50 | u8 preq[7]; /* SMP Pairing Request */ |
52 | u8 prsp[7]; /* SMP Pairing Response */ | 51 | u8 prsp[7]; /* SMP Pairing Response */ |
@@ -375,12 +374,6 @@ static void smp_chan_destroy(struct l2cap_conn *conn) | |||
375 | 374 | ||
376 | cancel_delayed_work_sync(&smp->security_timer); | 375 | cancel_delayed_work_sync(&smp->security_timer); |
377 | 376 | ||
378 | if (work_pending(&smp->distribute_work)) { | ||
379 | cancel_work_sync(&smp->distribute_work); | ||
380 | if (!chan->data) | ||
381 | return; | ||
382 | } | ||
383 | |||
384 | complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags); | 377 | complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags); |
385 | mgmt_smp_complete(conn->hcon, complete); | 378 | mgmt_smp_complete(conn->hcon, complete); |
386 | 379 | ||
@@ -703,10 +696,8 @@ static void smp_notify_keys(struct l2cap_conn *conn) | |||
703 | } | 696 | } |
704 | } | 697 | } |
705 | 698 | ||
706 | static void smp_distribute_keys(struct work_struct *work) | 699 | static void smp_distribute_keys(struct smp_chan *smp) |
707 | { | 700 | { |
708 | struct smp_chan *smp = container_of(work, struct smp_chan, | ||
709 | distribute_work); | ||
710 | struct smp_cmd_pairing *req, *rsp; | 701 | struct smp_cmd_pairing *req, *rsp; |
711 | struct l2cap_conn *conn = smp->conn; | 702 | struct l2cap_conn *conn = smp->conn; |
712 | struct hci_conn *hcon = conn->hcon; | 703 | struct hci_conn *hcon = conn->hcon; |
@@ -850,7 +841,6 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn) | |||
850 | smp->conn = conn; | 841 | smp->conn = conn; |
851 | chan->data = smp; | 842 | chan->data = smp; |
852 | 843 | ||
853 | INIT_WORK(&smp->distribute_work, smp_distribute_keys); | ||
854 | INIT_DELAYED_WORK(&smp->security_timer, smp_timeout); | 844 | INIT_DELAYED_WORK(&smp->security_timer, smp_timeout); |
855 | 845 | ||
856 | hci_conn_hold(conn->hcon); | 846 | hci_conn_hold(conn->hcon); |
@@ -1290,7 +1280,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1290 | rp->ediv, rp->rand); | 1280 | rp->ediv, rp->rand); |
1291 | smp->ltk = ltk; | 1281 | smp->ltk = ltk; |
1292 | if (!(smp->remote_key_dist & SMP_DIST_ID_KEY)) | 1282 | if (!(smp->remote_key_dist & SMP_DIST_ID_KEY)) |
1293 | queue_work(hdev->workqueue, &smp->distribute_work); | 1283 | smp_distribute_keys(smp); |
1294 | hci_dev_unlock(hdev); | 1284 | hci_dev_unlock(hdev); |
1295 | 1285 | ||
1296 | return 0; | 1286 | return 0; |
@@ -1368,7 +1358,7 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn, | |||
1368 | smp->id_addr_type, smp->irk, &rpa); | 1358 | smp->id_addr_type, smp->irk, &rpa); |
1369 | 1359 | ||
1370 | distribute: | 1360 | distribute: |
1371 | queue_work(hdev->workqueue, &smp->distribute_work); | 1361 | smp_distribute_keys(smp); |
1372 | 1362 | ||
1373 | hci_dev_unlock(hcon->hdev); | 1363 | hci_dev_unlock(hcon->hdev); |
1374 | 1364 | ||
@@ -1404,7 +1394,7 @@ static int smp_cmd_sign_info(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1404 | memcpy(csrk->val, rp->csrk, sizeof(csrk->val)); | 1394 | memcpy(csrk->val, rp->csrk, sizeof(csrk->val)); |
1405 | } | 1395 | } |
1406 | smp->csrk = csrk; | 1396 | smp->csrk = csrk; |
1407 | queue_work(hdev->workqueue, &smp->distribute_work); | 1397 | smp_distribute_keys(smp); |
1408 | hci_dev_unlock(hdev); | 1398 | hci_dev_unlock(hdev); |
1409 | 1399 | ||
1410 | return 0; | 1400 | return 0; |
@@ -1526,7 +1516,6 @@ static void smp_resume_cb(struct l2cap_chan *chan) | |||
1526 | struct smp_chan *smp = chan->data; | 1516 | struct smp_chan *smp = chan->data; |
1527 | struct l2cap_conn *conn = chan->conn; | 1517 | struct l2cap_conn *conn = chan->conn; |
1528 | struct hci_conn *hcon = conn->hcon; | 1518 | struct hci_conn *hcon = conn->hcon; |
1529 | struct hci_dev *hdev = hcon->hdev; | ||
1530 | 1519 | ||
1531 | BT_DBG("chan %p", chan); | 1520 | BT_DBG("chan %p", chan); |
1532 | 1521 | ||
@@ -1538,7 +1527,7 @@ static void smp_resume_cb(struct l2cap_chan *chan) | |||
1538 | 1527 | ||
1539 | cancel_delayed_work(&smp->security_timer); | 1528 | cancel_delayed_work(&smp->security_timer); |
1540 | 1529 | ||
1541 | queue_work(hdev->workqueue, &smp->distribute_work); | 1530 | smp_distribute_keys(smp); |
1542 | } | 1531 | } |
1543 | 1532 | ||
1544 | static void smp_ready_cb(struct l2cap_chan *chan) | 1533 | static void smp_ready_cb(struct l2cap_chan *chan) |