Message ID | 1286018724-7484-1-git-send-email-ospite@studenti.unina.it (mailing list archive) |
---|---|
State | Accepted |
Commit | d20d5ffab92f00188f360c44c791a5ffb988247c |
Headers | show |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 47d70c5..9eaf6ae 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -244,6 +244,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, mutex_lock(&minors_lock); dev = hidraw_table[minor]; + if (!dev) { + ret = -ENODEV; + goto out; + } switch (cmd) { case HIDIOCGRDESCSIZE: @@ -317,6 +321,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, ret = -ENOTTY; } +out: mutex_unlock(&minors_lock); return ret; }