diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-20 07:57:27 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-20 14:07:03 -0500 |
commit | 6c9d42a1615c6dc19c4a57a77d9c4b3d779bb741 (patch) | |
tree | 27c2c72dd631c05de40684535d2028441e2d792e | |
parent | c2ec9c1bbd17cdd1fc962f000b4ecb98c1dad830 (diff) |
Bluetooth: convert security timer to delayed_work
This one also needs to run in process context
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/l2cap.h | 2 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 12 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 7 |
3 files changed, 11 insertions, 10 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index e199c2f0e4dc..fc481d1ebf0b 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -532,7 +532,7 @@ struct l2cap_conn { | |||
532 | 532 | ||
533 | __u8 disc_reason; | 533 | __u8 disc_reason; |
534 | 534 | ||
535 | struct timer_list security_timer; | 535 | struct delayed_work security_timer; |
536 | struct smp_chan *smp_chan; | 536 | struct smp_chan *smp_chan; |
537 | 537 | ||
538 | struct list_head chan_l; | 538 | struct list_head chan_l; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 5978d69f3d8a..d0064550d83d 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1032,7 +1032,7 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) | |||
1032 | cancel_delayed_work_sync(&conn->info_work); | 1032 | cancel_delayed_work_sync(&conn->info_work); |
1033 | 1033 | ||
1034 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) { | 1034 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) { |
1035 | del_timer(&conn->security_timer); | 1035 | cancel_delayed_work_sync(&conn->security_timer); |
1036 | smp_chan_destroy(conn); | 1036 | smp_chan_destroy(conn); |
1037 | } | 1037 | } |
1038 | 1038 | ||
@@ -1040,9 +1040,10 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) | |||
1040 | kfree(conn); | 1040 | kfree(conn); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | static void security_timeout(unsigned long arg) | 1043 | static void security_timeout(struct work_struct *work) |
1044 | { | 1044 | { |
1045 | struct l2cap_conn *conn = (void *) arg; | 1045 | struct l2cap_conn *conn = container_of(work, struct l2cap_conn, |
1046 | security_timer.work); | ||
1046 | 1047 | ||
1047 | l2cap_conn_del(conn->hcon, ETIMEDOUT); | 1048 | l2cap_conn_del(conn->hcon, ETIMEDOUT); |
1048 | } | 1049 | } |
@@ -1086,8 +1087,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) | |||
1086 | INIT_LIST_HEAD(&conn->chan_l); | 1087 | INIT_LIST_HEAD(&conn->chan_l); |
1087 | 1088 | ||
1088 | if (hcon->type == LE_LINK) | 1089 | if (hcon->type == LE_LINK) |
1089 | setup_timer(&conn->security_timer, security_timeout, | 1090 | INIT_DELAYED_WORK(&conn->security_timer, security_timeout); |
1090 | (unsigned long) conn); | ||
1091 | else | 1091 | else |
1092 | INIT_DELAYED_WORK(&conn->info_work, l2cap_info_timeout); | 1092 | INIT_DELAYED_WORK(&conn->info_work, l2cap_info_timeout); |
1093 | 1093 | ||
@@ -4519,7 +4519,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4519 | 4519 | ||
4520 | if (hcon->type == LE_LINK) { | 4520 | if (hcon->type == LE_LINK) { |
4521 | smp_distribute_keys(conn, 0); | 4521 | smp_distribute_keys(conn, 0); |
4522 | del_timer(&conn->security_timer); | 4522 | cancel_delayed_work_sync(&conn->security_timer); |
4523 | } | 4523 | } |
4524 | 4524 | ||
4525 | rcu_read_lock(); | 4525 | rcu_read_lock(); |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 0b96737d0ad3..0ee2905a6179 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -184,7 +184,8 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data) | |||
184 | skb->priority = HCI_PRIO_MAX; | 184 | skb->priority = HCI_PRIO_MAX; |
185 | hci_send_acl(conn->hchan, skb, 0); | 185 | hci_send_acl(conn->hchan, skb, 0); |
186 | 186 | ||
187 | mod_timer(&conn->security_timer, jiffies + | 187 | cancel_delayed_work_sync(&conn->security_timer); |
188 | schedule_delayed_work(&conn->security_timer, | ||
188 | msecs_to_jiffies(SMP_TIMEOUT)); | 189 | msecs_to_jiffies(SMP_TIMEOUT)); |
189 | } | 190 | } |
190 | 191 | ||
@@ -240,7 +241,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send) | |||
240 | 241 | ||
241 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->pend); | 242 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->pend); |
242 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, reason); | 243 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, reason); |
243 | del_timer(&conn->security_timer); | 244 | cancel_delayed_work_sync(&conn->security_timer); |
244 | smp_chan_destroy(conn); | 245 | smp_chan_destroy(conn); |
245 | } | 246 | } |
246 | 247 | ||
@@ -800,7 +801,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force) | |||
800 | 801 | ||
801 | if (conn->hcon->out || force) { | 802 | if (conn->hcon->out || force) { |
802 | clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend); | 803 | clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend); |
803 | del_timer(&conn->security_timer); | 804 | cancel_delayed_work_sync(&conn->security_timer); |
804 | smp_chan_destroy(conn); | 805 | smp_chan_destroy(conn); |
805 | } | 806 | } |
806 | 807 | ||