diff options
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r-- | net/bluetooth/sco.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index ca6b2ad1c3fc..d0927d1fdada 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -165,11 +165,11 @@ static inline int sco_chan_add(struct sco_conn *conn, struct sock *sk, struct so | |||
165 | int err = 0; | 165 | int err = 0; |
166 | 166 | ||
167 | sco_conn_lock(conn); | 167 | sco_conn_lock(conn); |
168 | if (conn->sk) { | 168 | if (conn->sk) |
169 | err = -EBUSY; | 169 | err = -EBUSY; |
170 | } else { | 170 | else |
171 | __sco_chan_add(conn, sk, parent); | 171 | __sco_chan_add(conn, sk, parent); |
172 | } | 172 | |
173 | sco_conn_unlock(conn); | 173 | sco_conn_unlock(conn); |
174 | return err; | 174 | return err; |
175 | } | 175 | } |
@@ -241,22 +241,19 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) | |||
241 | BT_DBG("sk %p len %d", sk, len); | 241 | BT_DBG("sk %p len %d", sk, len); |
242 | 242 | ||
243 | count = min_t(unsigned int, conn->mtu, len); | 243 | count = min_t(unsigned int, conn->mtu, len); |
244 | if (!(skb = bt_skb_send_alloc(sk, count, msg->msg_flags & MSG_DONTWAIT, &err))) | 244 | skb = bt_skb_send_alloc(sk, count, |
245 | msg->msg_flags & MSG_DONTWAIT, &err); | ||
246 | if (!skb) | ||
245 | return err; | 247 | return err; |
246 | 248 | ||
247 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { | 249 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { |
248 | err = -EFAULT; | 250 | kfree_skb(skb); |
249 | goto fail; | 251 | return -EFAULT; |
250 | } | 252 | } |
251 | 253 | ||
252 | if ((err = hci_send_sco(conn->hcon, skb)) < 0) | 254 | hci_send_sco(conn->hcon, skb); |
253 | return err; | ||
254 | 255 | ||
255 | return count; | 256 | return count; |
256 | |||
257 | fail: | ||
258 | kfree_skb(skb); | ||
259 | return err; | ||
260 | } | 257 | } |
261 | 258 | ||
262 | static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) | 259 | static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) |
@@ -276,7 +273,6 @@ static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) | |||
276 | 273 | ||
277 | drop: | 274 | drop: |
278 | kfree_skb(skb); | 275 | kfree_skb(skb); |
279 | return; | ||
280 | } | 276 | } |
281 | 277 | ||
282 | /* -------- Socket interface ---------- */ | 278 | /* -------- Socket interface ---------- */ |
@@ -567,7 +563,7 @@ static int sco_sock_accept(struct socket *sock, struct socket *newsock, int flag | |||
567 | BT_DBG("sk %p timeo %ld", sk, timeo); | 563 | BT_DBG("sk %p timeo %ld", sk, timeo); |
568 | 564 | ||
569 | /* Wait for an incoming connection. (wake-one). */ | 565 | /* Wait for an incoming connection. (wake-one). */ |
570 | add_wait_queue_exclusive(sk->sk_sleep, &wait); | 566 | add_wait_queue_exclusive(sk_sleep(sk), &wait); |
571 | while (!(ch = bt_accept_dequeue(sk, newsock))) { | 567 | while (!(ch = bt_accept_dequeue(sk, newsock))) { |
572 | set_current_state(TASK_INTERRUPTIBLE); | 568 | set_current_state(TASK_INTERRUPTIBLE); |
573 | if (!timeo) { | 569 | if (!timeo) { |
@@ -590,7 +586,7 @@ static int sco_sock_accept(struct socket *sock, struct socket *newsock, int flag | |||
590 | } | 586 | } |
591 | } | 587 | } |
592 | set_current_state(TASK_RUNNING); | 588 | set_current_state(TASK_RUNNING); |
593 | remove_wait_queue(sk->sk_sleep, &wait); | 589 | remove_wait_queue(sk_sleep(sk), &wait); |
594 | 590 | ||
595 | if (err) | 591 | if (err) |
596 | goto done; | 592 | goto done; |
@@ -626,7 +622,7 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
626 | struct msghdr *msg, size_t len) | 622 | struct msghdr *msg, size_t len) |
627 | { | 623 | { |
628 | struct sock *sk = sock->sk; | 624 | struct sock *sk = sock->sk; |
629 | int err = 0; | 625 | int err; |
630 | 626 | ||
631 | BT_DBG("sock %p, sk %p", sock, sk); | 627 | BT_DBG("sock %p, sk %p", sock, sk); |
632 | 628 | ||
@@ -851,7 +847,8 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
851 | 847 | ||
852 | bh_lock_sock(parent); | 848 | bh_lock_sock(parent); |
853 | 849 | ||
854 | sk = sco_sock_alloc(sock_net(parent), NULL, BTPROTO_SCO, GFP_ATOMIC); | 850 | sk = sco_sock_alloc(sock_net(parent), NULL, |
851 | BTPROTO_SCO, GFP_ATOMIC); | ||
855 | if (!sk) { | 852 | if (!sk) { |
856 | bh_unlock_sock(parent); | 853 | bh_unlock_sock(parent); |
857 | goto done; | 854 | goto done; |