X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fbluetooth%2Fl2cap.c;h=6b995ac832f5f4fa5f7ab6c9e66c239afdd68bcf;hb=f58518e678e5eef430c8d5cdcc7cd28d285f1980;hp=477e052b17b5d57bdbb820f9b5b98252b13f17b9;hpb=41f81e88e01eb959f439f8537c58078e4bfc5291;p=linux-2.6-omap-h63xx.git diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 477e052b17b..6b995ac832f 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -99,13 +99,6 @@ static void l2cap_sock_clear_timer(struct sock *sk) sk_stop_timer(sk, &sk->sk_timer); } -static void l2cap_sock_init_timer(struct sock *sk) -{ - init_timer(&sk->sk_timer); - sk->sk_timer.function = l2cap_sock_timeout; - sk->sk_timer.data = (unsigned long)sk; -} - /* ---- L2CAP channels ---- */ static struct sock *__l2cap_get_chan_by_dcid(struct l2cap_chan_list *l, u16 cid) { @@ -395,9 +388,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) conn->feat_mask = 0; - init_timer(&conn->info_timer); - conn->info_timer.function = l2cap_info_timeout; - conn->info_timer.data = (unsigned long) conn; + setup_timer(&conn->info_timer, l2cap_info_timeout, (unsigned long)conn); spin_lock_init(&conn->lock); rwlock_init(&conn->chan_list.lock); @@ -426,6 +417,9 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) l2cap_sock_kill(sk); } + if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) + del_timer_sync(&conn->info_timer); + hcon->l2cap_data = NULL; kfree(conn); } @@ -622,7 +616,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p sk->sk_protocol = proto; sk->sk_state = BT_OPEN; - l2cap_sock_init_timer(sk); + setup_timer(&sk->sk_timer, l2cap_sock_timeout, (unsigned long)sk); bt_sock_link(&l2cap_sk_list, sk); return sk; @@ -1505,7 +1499,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd goto response; } - sk = l2cap_sock_alloc(parent->sk_net, NULL, BTPROTO_L2CAP, GFP_ATOMIC); + sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC); if (!sk) goto response;