OLD | NEW |
1 /* | 1 /* |
2 BlueZ - Bluetooth protocol stack for Linux | 2 BlueZ - Bluetooth protocol stack for Linux |
3 Copyright (C) 2000-2001 Qualcomm Incorporated | 3 Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | 4 |
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License version 2 as | 8 it under the terms of the GNU General Public License version 2 as |
9 published by the Free Software Foundation; | 9 published by the Free Software Foundation; |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 bt_cb(skb)->incoming = 0; | 154 bt_cb(skb)->incoming = 0; |
155 } | 155 } |
156 return skb; | 156 return skb; |
157 } | 157 } |
158 | 158 |
159 static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
en, | 159 static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
en, |
160 int nb, int *err) | 160 int nb, int *err) |
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); |
173 | 191 |
174 extern int hci_sock_init(void); | 192 extern int hci_sock_init(void); |
175 extern void hci_sock_cleanup(void); | 193 extern void hci_sock_cleanup(void); |
176 | 194 |
177 extern int bt_sysfs_init(void); | 195 extern int bt_sysfs_init(void); |
178 extern void bt_sysfs_cleanup(void); | 196 extern void bt_sysfs_cleanup(void); |
179 | 197 |
180 extern struct dentry *bt_debugfs; | 198 extern struct dentry *bt_debugfs; |
181 | 199 |
182 #endif /* __BLUETOOTH_H */ | 200 #endif /* __BLUETOOTH_H */ |
OLD | NEW |