lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091015164906.5b2c03db@lxorguk.ukuu.org.uk>
Date:	Thu, 15 Oct 2009 16:49:06 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Jeff Garzik <jeff@...zik.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>,
	Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [RFC] Remove or convert empty ioctls ?

On Thu, 15 Oct 2009 11:35:45 -0400
Jeff Garzik <jeff@...zik.org> wrote:

> On 10/15/2009 11:31 AM, Alan Cox wrote:
> > EINVAL means you used an ioctl that is correct for the driver but that
> > for some reason the driver didn't like it.
> 
> Precisely.
> 
> The driver author proactively chose to implement the ioctl and return a 
> value other than ENOTTY.

Jeff - wake up - take coffee if neeeded.

The case in question is the case where ->unlocked_ioctl() == NULL. In
that case the driver author didn't implement anything and the correct
return from the layer doing the handling is -ENOTTY.

In the case where there is an ioctl handler the common 

foo_ioctl()
{
	return -EINVAL;
}

stub case is simply broken, and caused by the fact a lot of early Linux
drivers were wrong and people keep propogating mistakes (a serious
problem in the open source world is that most code is produced by copying
stuff but often by copying buggy code).

Essentially the only times you should be returning -EINVAL is where the
driver actually has


	case IOCWIBBLE:
		/* Do stuff */
		if (foo < 1)
			return -EINVAL;

All the "I don't know this" cases should be -ENOTTY.

There are cases where

	case IOCWIBBLE:
		return -EINVAL;

is correct but they are unusual - basically the case where the driver
author wants to "support" the ioctl but there is no argument that it can
be given which is correct.


Anyway the case discussed which is ".unlocked_ioctl = NULL" should return
-ENOTTY, and there isn't any argument about the driver authors intentions.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ