]> err.no Git - linux-2.6/blobdiff - net/bluetooth/hci_conn.c
ipv6: syncookies: free reqsk on xfrm_lookup error
[linux-2.6] / net / bluetooth / hci_conn.c
index 0d4b8aeb8e09bd76e06ff0239d78bcd75021f03d..ca8d05245ca0cb9e27586cfdbdeb90e5afff81e3 100644 (file)
@@ -245,8 +245,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
 
-       hci_conn_add_sysfs(conn);
-
        tasklet_enable(&hdev->tx_task);
 
        return conn;
@@ -278,12 +276,14 @@ int hci_conn_del(struct hci_conn *conn)
        }
 
        tasklet_disable(&hdev->tx_task);
+
        hci_conn_hash_del(hdev, conn);
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
+
        tasklet_enable(&hdev->tx_task);
+
        skb_queue_purge(&conn->data_q);
-       hci_conn_del_sysfs(conn);
 
        return 0;
 }
@@ -532,6 +532,8 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
 
                c->state = BT_CLOSED;
 
+               hci_conn_del_sysfs(c);
+
                hci_proto_disconn_ind(c, 0x16);
                hci_conn_del(c);
        }