[PATCH] fix tiocgdev 32/64bit emul
From: Jeff Garzik
Date: Sun Mar 21 2004 - 11:46:59 EST
linguist@xxxxxxxxxxxxxxxxxx wrote:
This is just a random observation, I don't know this piece of code
or the kernel in general, but instinct tells me that where is says
"if (!fd) return -EBADF", it should say "if (!file) return -EBADF".
Just a heads up.
Regards,
Rich
static int tiocgdev(unsigned fd, unsigned cmd, unsigned int *ptr)
{
struct file *file = fget(fd);
struct tty_struct *real_tty;
if (!fd)
return -EBADF;
Yup, looks like a real bug to me... good catch.
Untested but obvious patch attached.
Jeff
===== arch/x86_64/ia32/ia32_ioctl.c 1.38 vs edited =====
--- 1.38/arch/x86_64/ia32/ia32_ioctl.c Wed Feb 25 11:06:01 2004
+++ edited/arch/x86_64/ia32/ia32_ioctl.c Sun Mar 21 11:43:56 2004
@@ -27,7 +27,7 @@
struct file *file = fget(fd);
struct tty_struct *real_tty;
- if (!fd)
+ if (!file)
return -EBADF;
if (file->f_op->ioctl != tty_ioctl)
return -EINVAL;