diff options
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 75302a986067..38f08f6b86f6 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -329,6 +329,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
329 | } | 329 | } |
330 | 330 | ||
331 | if (mask & HCI_CMSG_TSTAMP) { | 331 | if (mask & HCI_CMSG_TSTAMP) { |
332 | #ifdef CONFIG_COMPAT | ||
333 | struct compat_timeval ctv; | ||
334 | #endif | ||
332 | struct timeval tv; | 335 | struct timeval tv; |
333 | void *data; | 336 | void *data; |
334 | int len; | 337 | int len; |
@@ -339,7 +342,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
339 | len = sizeof(tv); | 342 | len = sizeof(tv); |
340 | #ifdef CONFIG_COMPAT | 343 | #ifdef CONFIG_COMPAT |
341 | if (msg->msg_flags & MSG_CMSG_COMPAT) { | 344 | if (msg->msg_flags & MSG_CMSG_COMPAT) { |
342 | struct compat_timeval ctv; | ||
343 | ctv.tv_sec = tv.tv_sec; | 345 | ctv.tv_sec = tv.tv_sec; |
344 | ctv.tv_usec = tv.tv_usec; | 346 | ctv.tv_usec = tv.tv_usec; |
345 | data = &ctv; | 347 | data = &ctv; |
@@ -414,6 +416,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
414 | goto done; | 416 | goto done; |
415 | } | 417 | } |
416 | 418 | ||
419 | if (!test_bit(HCI_UP, &hdev->flags)) { | ||
420 | err = -ENETDOWN; | ||
421 | goto done; | ||
422 | } | ||
423 | |||
417 | if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) | 424 | if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) |
418 | goto done; | 425 | goto done; |
419 | 426 | ||
@@ -440,10 +447,10 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
440 | 447 | ||
441 | if (test_bit(HCI_RAW, &hdev->flags) || (ogf == 0x3f)) { | 448 | if (test_bit(HCI_RAW, &hdev->flags) || (ogf == 0x3f)) { |
442 | skb_queue_tail(&hdev->raw_q, skb); | 449 | skb_queue_tail(&hdev->raw_q, skb); |
443 | hci_sched_tx(hdev); | 450 | tasklet_schedule(&hdev->tx_task); |
444 | } else { | 451 | } else { |
445 | skb_queue_tail(&hdev->cmd_q, skb); | 452 | skb_queue_tail(&hdev->cmd_q, skb); |
446 | hci_sched_cmd(hdev); | 453 | tasklet_schedule(&hdev->cmd_task); |
447 | } | 454 | } |
448 | } else { | 455 | } else { |
449 | if (!capable(CAP_NET_RAW)) { | 456 | if (!capable(CAP_NET_RAW)) { |
@@ -452,7 +459,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
452 | } | 459 | } |
453 | 460 | ||
454 | skb_queue_tail(&hdev->raw_q, skb); | 461 | skb_queue_tail(&hdev->raw_q, skb); |
455 | hci_sched_tx(hdev); | 462 | tasklet_schedule(&hdev->tx_task); |
456 | } | 463 | } |
457 | 464 | ||
458 | err = len; | 465 | err = len; |
@@ -621,7 +628,8 @@ static struct proto hci_sk_proto = { | |||
621 | .obj_size = sizeof(struct hci_pinfo) | 628 | .obj_size = sizeof(struct hci_pinfo) |
622 | }; | 629 | }; |
623 | 630 | ||
624 | static int hci_sock_create(struct net *net, struct socket *sock, int protocol) | 631 | static int hci_sock_create(struct net *net, struct socket *sock, int protocol, |
632 | int kern) | ||
625 | { | 633 | { |
626 | struct sock *sk; | 634 | struct sock *sk; |
627 | 635 | ||
@@ -687,7 +695,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event, | |||
687 | return NOTIFY_DONE; | 695 | return NOTIFY_DONE; |
688 | } | 696 | } |
689 | 697 | ||
690 | static struct net_proto_family hci_sock_family_ops = { | 698 | static const struct net_proto_family hci_sock_family_ops = { |
691 | .family = PF_BLUETOOTH, | 699 | .family = PF_BLUETOOTH, |
692 | .owner = THIS_MODULE, | 700 | .owner = THIS_MODULE, |
693 | .create = hci_sock_create, | 701 | .create = hci_sock_create, |