aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/smp.c12
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);