diff options
-rw-r--r-- | net/bluetooth/sco.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 541b26efb724..4767928a93d3 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,21 +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 | hci_send_sco(conn->hcon, skb); | 254 | hci_send_sco(conn->hcon, skb); |
253 | 255 | ||
254 | return count; | 256 | return count; |
255 | |||
256 | fail: | ||
257 | kfree_skb(skb); | ||
258 | return err; | ||
259 | } | 257 | } |
260 | 258 | ||
261 | 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) |
@@ -625,7 +623,7 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
625 | struct msghdr *msg, size_t len) | 623 | struct msghdr *msg, size_t len) |
626 | { | 624 | { |
627 | struct sock *sk = sock->sk; | 625 | struct sock *sk = sock->sk; |
628 | int err = 0; | 626 | int err; |
629 | 627 | ||
630 | BT_DBG("sock %p, sk %p", sock, sk); | 628 | BT_DBG("sock %p, sk %p", sock, sk); |
631 | 629 | ||
@@ -850,7 +848,8 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
850 | 848 | ||
851 | bh_lock_sock(parent); | 849 | bh_lock_sock(parent); |
852 | 850 | ||
853 | sk = sco_sock_alloc(sock_net(parent), NULL, BTPROTO_SCO, GFP_ATOMIC); | 851 | sk = sco_sock_alloc(sock_net(parent), NULL, |
852 | BTPROTO_SCO, GFP_ATOMIC); | ||
854 | if (!sk) { | 853 | if (!sk) { |
855 | bh_unlock_sock(parent); | 854 | bh_unlock_sock(parent); |
856 | goto done; | 855 | goto done; |