diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-20 13:13:31 +0300 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-20 13:13:31 +0300 |
commit | ff607748590fba14aecedb0d50edc4ada98d4302 (patch) | |
tree | 986e0a3abe922713069a8e8bc913043fed89a39a /net/bluetooth/hci_sock.c | |
parent | db024d5398cd332023896caf70530564b15ec88e (diff) | |
parent | 6aff8f1f07a7fff48121d1ad4a550f3af24ccc81 (diff) | |
download | linux-ff607748590fba14aecedb0d50edc4ada98d4302.tar.xz |
Merge branch 'upstream'
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index bdb6458c6bd5..97bdec73d17e 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -143,13 +143,15 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) static int hci_sock_release(struct socket *sock) { struct sock *sk = sock->sk; - struct hci_dev *hdev = hci_pi(sk)->hdev; + struct hci_dev *hdev; BT_DBG("sock %p sk %p", sock, sk); if (!sk) return 0; + hdev = hci_pi(sk)->hdev; + bt_sock_unlink(&hci_sk_list, sk); if (hdev) { @@ -311,14 +313,18 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, int *add { struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr; struct sock *sk = sock->sk; + struct hci_dev *hdev = hci_pi(sk)->hdev; BT_DBG("sock %p sk %p", sock, sk); + if (!hdev) + return -EBADFD; + lock_sock(sk); *addr_len = sizeof(*haddr); haddr->hci_family = AF_BLUETOOTH; - haddr->hci_dev = hci_pi(sk)->hdev->id; + haddr->hci_dev = hdev->id; release_sock(sk); return 0; |