User: | Jiri Slaby |
Error type: | Double Lock |
Error type description: | Some lock is locked twice unintentionally in a sequence |
File location: | drivers/hid/hidraw.c |
Line in file: | 52 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Confirmation: | Fixed by b0e14951ee0f6c29abc64b92ec7075a159ede37c |
Tools: |
Stanse
(1.2)
Clang Static Analyzer (3.0) |
Entered: | 2011-11-07 22:19:59 UTC |
22#include <linux/fs.h> 23#include <linux/module.h> 24#include <linux/errno.h> 25#include <linux/kernel.h> 26#include <linux/init.h> 27#include <linux/cdev.h> 28#include <linux/poll.h> 29#include <linux/device.h> 30#include <linux/major.h> 31#include <linux/hid.h> 32#include <linux/mutex.h> 33#include <linux/smp_lock.h> 34 35#include <linux/hidraw.h> 36 37static int hidraw_major; 38static struct cdev hidraw_cdev; 39static struct class *hidraw_class; 40static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES]; 41static DEFINE_MUTEX(minors_lock); 42 43static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) 44{ 45 struct hidraw_list *list = file->private_data; 46 int ret = 0, len; 47 char *report; 48 DECLARE_WAITQUEUE(wait, current); 49 50 while (ret == 0) { 51 52 mutex_lock(&list->read_mutex); 53 54 if (list->head == list->tail) { 55 add_wait_queue(&list->hidraw->wait, &wait); 56 set_current_state(TASK_INTERRUPTIBLE); 57 58 while (list->head == list->tail) { 59 if (file->f_flags & O_NONBLOCK) { 60 ret = -EAGAIN; 61 break; 62 }