Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104969
b: refs/heads/master
c: 7961df1
h: refs/heads/master
i:
  104967: 2225255
v: v3
  • Loading branch information
Alan Cox authored and Jiri Kosina committed Jul 23, 2008
1 parent e59e36b commit aa57a1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f0168d2dacd7972d887e1ca27943ef8af7512a5
refs/heads/master: 7961df16819085b8a357720d89d0239036e6af2a
11 changes: 9 additions & 2 deletions trunk/drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
uref_multi = kmalloc(sizeof(struct hiddev_usage_ref_multi), GFP_KERNEL);
if (!uref_multi)
return -ENOMEM;
lock_kernel();
uref = &uref_multi->uref;
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
if (copy_from_user(uref_multi, user_arg,
Expand Down Expand Up @@ -501,12 +502,15 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
}

goodreturn:
unlock_kernel();
kfree(uref_multi);
return 0;
fault:
unlock_kernel();
kfree(uref_multi);
return -EFAULT;
inval:
unlock_kernel();
kfree(uref_multi);
return -EINVAL;
}
Expand Down Expand Up @@ -540,7 +544,7 @@ static noinline int hiddev_ioctl_string(struct hiddev *hiddev, unsigned int cmd,
return len;
}

static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct hiddev_list *list = file->private_data;
struct hiddev *hiddev = list->hiddev;
Expand All @@ -555,7 +559,10 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
struct usbhid_device *usbhid = hid->driver_data;
void __user *user_arg = (void __user *)arg;
int i;

/* Called without BKL by compat methods so no BKL taken */

/* FIXME: Who or what stop this racing with a disconnect ?? */
if (!hiddev->exist)
return -EIO;

Expand Down Expand Up @@ -768,7 +775,7 @@ static const struct file_operations hiddev_fops = {
.poll = hiddev_poll,
.open = hiddev_open,
.release = hiddev_release,
.ioctl = hiddev_ioctl,
.unlocked_ioctl = hiddev_ioctl,
.fasync = hiddev_fasync,
#ifdef CONFIG_COMPAT
.compat_ioctl = hiddev_compat_ioctl,
Expand Down

0 comments on commit aa57a1f

Please sign in to comment.