aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth/bluetooth.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/bluetooth/bluetooth.h')
-rw-r--r--include/net/bluetooth/bluetooth.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 27a902d9b3a9..d81ea7997701 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -126,6 +126,8 @@ int bt_sock_unregister(int proto);
126void bt_sock_link(struct bt_sock_list *l, struct sock *s); 126void bt_sock_link(struct bt_sock_list *l, struct sock *s);
127void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 127void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
128int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); 128int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags);
129int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
130 struct msghdr *msg, size_t len, int flags);
129uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); 131uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait);
130int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 132int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
131int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 133int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
@@ -161,12 +163,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
161{ 163{
162 struct sk_buff *skb; 164 struct sk_buff *skb;
163 165
166 release_sock(sk);
164 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { 167 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) {
165 skb_reserve(skb, BT_SKB_RESERVE); 168 skb_reserve(skb, BT_SKB_RESERVE);
166 bt_cb(skb)->incoming = 0; 169 bt_cb(skb)->incoming = 0;
167 } 170 }
171 lock_sock(sk);
172
173 if (!skb && *err)
174 return NULL;
175
176 *err = sock_error(sk);
177 if (*err)
178 goto out;
179
180 if (sk->sk_shutdown) {
181 *err = -ECONNRESET;
182 goto out;
183 }
168 184
169 return skb; 185 return skb;
186
187out:
188 kfree_skb(skb);
189 return NULL;
170} 190}
171 191
172int bt_err(__u16 code); 192int bt_err(__u16 code);