aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKirill Korotaev <dev@sw.ru>2005-09-09 16:05:53 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 17:19:43 -0400
commit35311d6478077f7bfe35c1c653193e658bf32686 (patch)
tree2bad647ab30da08786e05f988787d92815dec06e /arch
parentb95adac775aad29f79ffbbaf5db0e4d8d57f2714 (diff)
[PATCH] lost fput in 32bit ioctl on x86-64
This adds a lost fput in 32bit tiocgdev ioctl on x86-64 [ chrisw: Updated to use fget_light/fput_light ] Signed-Off-By: Kirill Korotaev <dev@sw.ru> Signed-Off-By: Maxim Giryaev <gem@sw.ru> Signed-off-by: Chris Wright <chrisw@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-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 */