public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Ebbert <cebbert@redhat.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>, Alan <alan@lxorguk.ukuu.org.uk>,
	Al Viro <viro@ftp.linux.org.uk>
Subject: [patch] compat_ioctl should return -ENOTTY for some failures
Date: Mon, 12 Feb 2007 18:16:46 -0500	[thread overview]
Message-ID: <45D0F55E.9040101@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

In many cases compat_ioctl() should return -ENOTTY.

Recent changes in this area seem to be breaking some
Wine apps.  I'm not proposing this for inclusion (yet,)
I just want to know if I've hit the right places.


[-- Attachment #2: compat_ioctl_proper_error.patch --]
[-- Type: text/plain, Size: 1134 bytes --]

Index: 2.6.20-d390/fs/compat.c
===================================================================
--- 2.6.20-d390.orig/fs/compat.c	2007-02-12 13:24:20.000000000 -0500
+++ 2.6.20-d390/fs/compat.c	2007-02-12 16:16:08.000000000 -0500
@@ -439,15 +439,10 @@
 	}
 
 	if (S_ISSOCK(filp->f_path.dentry->d_inode->i_mode) &&
-	    cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
+	    cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15))
 		error = siocdevprivate_ioctl(fd, cmd, arg);
-	} else {
-		static int count;
-
-		if (++count <= 50)
-			compat_ioctl_error(filp, fd, cmd, arg);
-		error = -EINVAL;
-	}
+	else
+		error = -ENOTTY;
 
 	goto out_fput;
 
Index: 2.6.20-d390/fs/ioctl.c
===================================================================
--- 2.6.20-d390.orig/fs/ioctl.c	2007-02-12 13:24:20.000000000 -0500
+++ 2.6.20-d390/fs/ioctl.c	2007-02-12 16:14:29.000000000 -0500
@@ -27,7 +27,7 @@
 	if (filp->f_op->unlocked_ioctl) {
 		error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
 		if (error == -ENOIOCTLCMD)
-			error = -EINVAL;
+			error = -ENOTTY;
 		goto out;
 	} else if (filp->f_op->ioctl) {
 		lock_kernel();

                 reply	other threads:[~2007-02-12 23:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45D0F55E.9040101@redhat.com \
    --to=cebbert@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox