Skip to contentSkip to conversation

compat_ioctl should return -ENOTTY for some failures

PATCH New Chuck Ebbert 1 participant 1 message Feb 12, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat_ioctl should return -ENOTTY for some failures

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.

fs/compat.c +3 -8
Index: 2.6.20-d390/fs/compat.c
===================================================================
@@ -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;
 
fs/ioctl.c +1 -1
Index: 2.6.20-d390/fs/ioctl.c
===================================================================
@@ -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();