aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/hci_vhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bluetooth/hci_vhci.c')
-rw-r--r--drivers/bluetooth/hci_vhci.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 0638730a4a19..d97700aa54a9 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -28,6 +28,7 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/smp_lock.h>
31#include <linux/types.h> 32#include <linux/types.h>
32#include <linux/errno.h> 33#include <linux/errno.h>
33#include <linux/sched.h> 34#include <linux/sched.h>
@@ -263,9 +264,11 @@ static int vhci_open(struct inode *inode, struct file *file)
263 skb_queue_head_init(&data->readq); 264 skb_queue_head_init(&data->readq);
264 init_waitqueue_head(&data->read_wait); 265 init_waitqueue_head(&data->read_wait);
265 266
267 lock_kernel();
266 hdev = hci_alloc_dev(); 268 hdev = hci_alloc_dev();
267 if (!hdev) { 269 if (!hdev) {
268 kfree(data); 270 kfree(data);
271 unlock_kernel();
269 return -ENOMEM; 272 return -ENOMEM;
270 } 273 }
271 274
@@ -286,10 +289,12 @@ static int vhci_open(struct inode *inode, struct file *file)
286 BT_ERR("Can't register HCI device"); 289 BT_ERR("Can't register HCI device");
287 kfree(data); 290 kfree(data);
288 hci_free_dev(hdev); 291 hci_free_dev(hdev);
292 unlock_kernel();
289 return -EBUSY; 293 return -EBUSY;
290 } 294 }
291 295
292 file->private_data = data; 296 file->private_data = data;
297 unlock_kernel();
293 298
294 return nonseekable_open(inode, file); 299 return nonseekable_open(inode, file);
295} 300}
@@ -313,18 +318,21 @@ static int vhci_release(struct inode *inode, struct file *file)
313static int vhci_fasync(int fd, struct file *file, int on) 318static int vhci_fasync(int fd, struct file *file, int on)
314{ 319{
315 struct vhci_data *data = file->private_data; 320 struct vhci_data *data = file->private_data;
316 int err; 321 int err = 0;
317 322
323 lock_kernel();
318 err = fasync_helper(fd, file, on, &data->fasync); 324 err = fasync_helper(fd, file, on, &data->fasync);
319 if (err < 0) 325 if (err < 0)
320 return err; 326 goto out;
321 327
322 if (on) 328 if (on)
323 data->flags |= VHCI_FASYNC; 329 data->flags |= VHCI_FASYNC;
324 else 330 else
325 data->flags &= ~VHCI_FASYNC; 331 data->flags &= ~VHCI_FASYNC;
326 332
327 return 0; 333out:
334 unlock_kernel();
335 return err;
328} 336}
329 337
330static const struct file_operations vhci_fops = { 338static const struct file_operations vhci_fops = {