diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-08-11 15:06:42 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-08-14 02:49:24 -0400 |
commit | 109ec2309eb996fbe03302fbd40dec9014c6f849 (patch) | |
tree | 962bea2291441b713848b19743c4b9528ccbd141 /net/bluetooth | |
parent | 276d807317dead63ef2f13aa46e3c17d57ba0713 (diff) |
Bluetooth: Move canceling security_timer into smp_chan_destroy()
All places needing to cancel the security timer also call
smp_chan_destroy() in the same go. To eliminate the need to do these two
calls in multiple places simply move the timer cancellation into
smp_chan_destroy().
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/smp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 7ab5f52955cb..cdae40869447 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -384,8 +384,6 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason) | |||
384 | 384 | ||
385 | smp = chan->data; | 385 | smp = chan->data; |
386 | 386 | ||
387 | cancel_delayed_work_sync(&smp->security_timer); | ||
388 | |||
389 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) | 387 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) |
390 | smp_chan_destroy(conn); | 388 | smp_chan_destroy(conn); |
391 | } | 389 | } |
@@ -765,7 +763,6 @@ static int smp_distribute_keys(struct l2cap_conn *conn) | |||
765 | return 0; | 763 | return 0; |
766 | 764 | ||
767 | clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags); | 765 | clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags); |
768 | cancel_delayed_work_sync(&smp->security_timer); | ||
769 | set_bit(SMP_FLAG_COMPLETE, &smp->flags); | 766 | set_bit(SMP_FLAG_COMPLETE, &smp->flags); |
770 | smp_notify_keys(conn); | 767 | smp_notify_keys(conn); |
771 | 768 | ||
@@ -822,6 +819,11 @@ void smp_chan_destroy(struct l2cap_conn *conn) | |||
822 | 819 | ||
823 | BUG_ON(!smp); | 820 | BUG_ON(!smp); |
824 | 821 | ||
822 | cancel_delayed_work_sync(&smp->security_timer); | ||
823 | /* In case the timeout freed the SMP context */ | ||
824 | if (!chan->data) | ||
825 | return; | ||
826 | |||
825 | complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags); | 827 | complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags); |
826 | mgmt_smp_complete(conn->hcon, complete); | 828 | mgmt_smp_complete(conn->hcon, complete); |
827 | 829 | ||
@@ -1512,10 +1514,8 @@ static void smp_teardown_cb(struct l2cap_chan *chan, int err) | |||
1512 | 1514 | ||
1513 | BT_DBG("chan %p", chan); | 1515 | BT_DBG("chan %p", chan); |
1514 | 1516 | ||
1515 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) { | 1517 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) |
1516 | cancel_delayed_work_sync(&smp->security_timer); | ||
1517 | smp_chan_destroy(conn); | 1518 | smp_chan_destroy(conn); |
1518 | } | ||
1519 | 1519 | ||
1520 | conn->smp = NULL; | 1520 | conn->smp = NULL; |
1521 | l2cap_chan_put(chan); | 1521 | l2cap_chan_put(chan); |