diff options
Diffstat (limited to 'net/bluetooth/rfcomm/sock.c')
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index c9054487670a..8a972b6ba85f 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -307,13 +307,13 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int | |||
307 | sk->sk_destruct = rfcomm_sock_destruct; | 307 | sk->sk_destruct = rfcomm_sock_destruct; |
308 | sk->sk_sndtimeo = RFCOMM_CONN_TIMEOUT; | 308 | sk->sk_sndtimeo = RFCOMM_CONN_TIMEOUT; |
309 | 309 | ||
310 | sk->sk_sndbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10; | 310 | sk->sk_sndbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10; |
311 | sk->sk_rcvbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10; | 311 | sk->sk_rcvbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10; |
312 | 312 | ||
313 | sock_reset_flag(sk, SOCK_ZAPPED); | 313 | sock_reset_flag(sk, SOCK_ZAPPED); |
314 | 314 | ||
315 | sk->sk_protocol = proto; | 315 | sk->sk_protocol = proto; |
316 | sk->sk_state = BT_OPEN; | 316 | sk->sk_state = BT_OPEN; |
317 | 317 | ||
318 | bt_sock_link(&rfcomm_sk_list, sk); | 318 | bt_sock_link(&rfcomm_sk_list, sk); |
319 | 319 | ||
@@ -411,6 +411,8 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a | |||
411 | bacpy(&bt_sk(sk)->dst, &sa->rc_bdaddr); | 411 | bacpy(&bt_sk(sk)->dst, &sa->rc_bdaddr); |
412 | rfcomm_pi(sk)->channel = sa->rc_channel; | 412 | rfcomm_pi(sk)->channel = sa->rc_channel; |
413 | 413 | ||
414 | d->link_mode = rfcomm_pi(sk)->link_mode; | ||
415 | |||
414 | err = rfcomm_dlc_open(d, &bt_sk(sk)->src, &sa->rc_bdaddr, sa->rc_channel); | 416 | err = rfcomm_dlc_open(d, &bt_sk(sk)->src, &sa->rc_bdaddr, sa->rc_channel); |
415 | if (!err) | 417 | if (!err) |
416 | err = bt_sock_wait_state(sk, BT_CONNECTED, | 418 | err = bt_sock_wait_state(sk, BT_CONNECTED, |
@@ -686,6 +688,8 @@ static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
686 | copied += chunk; | 688 | copied += chunk; |
687 | size -= chunk; | 689 | size -= chunk; |
688 | 690 | ||
691 | sock_recv_timestamp(msg, sk, skb); | ||
692 | |||
689 | if (!(flags & MSG_PEEK)) { | 693 | if (!(flags & MSG_PEEK)) { |
690 | atomic_sub(chunk, &sk->sk_rmem_alloc); | 694 | atomic_sub(chunk, &sk->sk_rmem_alloc); |
691 | 695 | ||
@@ -791,15 +795,20 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon | |||
791 | struct sock *sk = sock->sk; | 795 | struct sock *sk = sock->sk; |
792 | int err; | 796 | int err; |
793 | 797 | ||
794 | lock_sock(sk); | 798 | BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg); |
799 | |||
800 | err = bt_sock_ioctl(sock, cmd, arg); | ||
795 | 801 | ||
802 | if (err == -ENOIOCTLCMD) { | ||
796 | #ifdef CONFIG_BT_RFCOMM_TTY | 803 | #ifdef CONFIG_BT_RFCOMM_TTY |
797 | err = rfcomm_dev_ioctl(sk, cmd, (void __user *)arg); | 804 | lock_sock(sk); |
805 | err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg); | ||
806 | release_sock(sk); | ||
798 | #else | 807 | #else |
799 | err = -EOPNOTSUPP; | 808 | err = -EOPNOTSUPP; |
800 | #endif | 809 | #endif |
810 | } | ||
801 | 811 | ||
802 | release_sock(sk); | ||
803 | return err; | 812 | return err; |
804 | } | 813 | } |
805 | 814 | ||