aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/ia32/ia32_ioctl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
index d259f8a6f811..419758f19ca4 100644
--- a/arch/x86_64/ia32/ia32_ioctl.c
+++ b/arch/x86_64/ia32/ia32_ioctl.c
@@ -24,17 +24,26 @@
24static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr) 24static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr)
25{ 25{
26 26
27 struct file *file = fget(fd); 27 struct file *file;
28 struct tty_struct *real_tty; 28 struct tty_struct *real_tty;
29 int fput_needed, ret;
29 30
31 file = fget_light(fd, &fput_needed);
30 if (!file) 32 if (!file)
31 return -EBADF; 33 return -EBADF;
34
35 ret = -EINVAL;
32 if (file->f_op->ioctl != tty_ioctl) 36 if (file->f_op->ioctl != tty_ioctl)
33 return -EINVAL; 37 goto out;
34 real_tty = (struct tty_struct *)file->private_data; 38 real_tty = (struct tty_struct *)file->private_data;
35 if (!real_tty) 39 if (!real_tty)
36 return -EINVAL; 40 goto out;
37 return put_user(new_encode_dev(tty_devnum(real_tty)), ptr); 41
42 ret = put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
43
44out:
45 fput_light(file, fput_needed);
46 return ret;
38} 47}
39 48
40#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */ 49#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */