[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200910162142.50618.arnd@arndb.de>
Date: Fri, 16 Oct 2009 21:42:50 +0200
From: Arnd Bergmann <arndbergmann@...glemail.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Arnd Bergmann <arndbergmann@...glemail.com>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
Jeff Dike <jdike@...toit.com>
Subject: Re: [patch 6/7] um: Convert mmapper to unlocked_ioctl
On Thursday 15 October 2009, Alan Cox wrote:
> On Thu, 15 Oct 2009 15:00:34 +0200
> Arnd Bergmann <arndbergmann@...glemail.com> wrote:
>
> > However, returning -ENOIOCTLCMD from an *unlocked_ioctl* function
> > automatically gets turned into -EINVAL. It does this to allow
> > the same functions to be used for unlocked_ioctl and compat_ioctl.
> > In effect, this patch is functionally identical to removing the
> > ioctl function, which I think is what should be done here.
>
> That is wrong.
>
> SuS requires an unknown ioctl code returns -ENOTTY. If the code is
> currently remapping it to EINVAL then it wants fixing.
Right, I forgot about the EINVAL/ENOTTY difference. The code currently
returns -ENOIOCTLCMD, which is worse. Thomas' patch makes it return
-EINVAL, which as you said is still wrong. Removing the ioctl function
will do the right thing and return -ENOTTY, so that should be done
here in um/mmapper, with an appropriate changelog.
For the common code in fs/ioctl.c, I think the current behaviour is
correct. It returns -EINVAL if the driver returns -ENOIOCTLCMD, iow
"the request [...] argument is not valid for this device", as specified
by http://www.opengroup.org/onlinepubs/009695399/functions/ioctl.html.
Drivers returning ENOIOCTLCMD for every request are broken and should
be changed to have no ioctl function.
Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists