lkml.org 
[lkml]   [2004]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fix tiocgdev 32/64bit emul
linguist@masterlinkcorp.com 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;
\
 
 \ /
  Last update: 2005-03-22 14:01    [from the cache]
©2003-2011 Jasper Spaans