diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 27a902d9b3a9..30fce0128dd7 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -161,12 +161,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l | |||
161 | { | 161 | { |
162 | struct sk_buff *skb; | 162 | struct sk_buff *skb; |
163 | 163 | ||
164 | release_sock(sk); | ||
164 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { | 165 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { |
165 | skb_reserve(skb, BT_SKB_RESERVE); | 166 | skb_reserve(skb, BT_SKB_RESERVE); |
166 | bt_cb(skb)->incoming = 0; | 167 | bt_cb(skb)->incoming = 0; |
167 | } | 168 | } |
169 | lock_sock(sk); | ||
170 | |||
171 | if (!skb && *err) | ||
172 | return NULL; | ||
173 | |||
174 | *err = sock_error(sk); | ||
175 | if (*err) | ||
176 | goto out; | ||
177 | |||
178 | if (sk->sk_shutdown) { | ||
179 | *err = -ECONNRESET; | ||
180 | goto out; | ||
181 | } | ||
168 | 182 | ||
169 | return skb; | 183 | return skb; |
184 | |||
185 | out: | ||
186 | kfree_skb(skb); | ||
187 | return NULL; | ||
170 | } | 188 | } |
171 | 189 | ||
172 | int bt_err(__u16 code); | 190 | int bt_err(__u16 code); |