Skip to contentSkip to conversation

pipe: return -ENOIOCTLCMD instead of -EINVAL on unknown ioctl command

PATCH In review Will Deacon 2 participants 2 messages May 25, 2012 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pipe: return -ENOIOCTLCMD instead of -EINVAL on unknown ioctl command

As described in commit 07d106d0a ("vfs: fix up ENOIOCTLCMD error handling"), drivers should return -ENOIOCTLCMD if they receive an ioctl command which they don't understand. Doing so will result in -ENOTTY being returned to userspace, which matches the behaviour of the compat layer if it fails to translate an ioctl command.

This patch fixes the pipe ioctl to return -ENOIOCTLCMD instead of -EINVAL when passed an unknown ioctl command.

Cc Al Viro <[email protected]>
Cc Andrew Morton <[email protected]>
---
 fs/pipe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/pipe.c +1 -1
index fec5e4a..95ebb56 100644
@@ -693,7 +693,7 @@ static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 			return put_user(count, (int __user *)arg);
 		default:
-			return -EINVAL;
+			return -ENOIOCTLCMD;
 	}
 }
 
Signature · 1 line
1.7.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Fri, 25 May 2012 11:39:13 +0100 Will Deacon <[email protected]> wrote:

As described in commit 07d106d0a ("vfs: fix up ENOIOCTLCMD error handling"), drivers should return -ENOIOCTLCMD if they receive an ioctl command which they don't understand. Doing so will result in -ENOTTY being returned to userspace, which matches the behaviour of the compat layer if it fails to translate an ioctl command.

Quoted 6 lines

This patch fixes the pipe ioctl to return -ENOIOCTLCMD instead of -EINVAL when passed an unknown ioctl command.

Cc Al Viro <[email protected]>
Cc Andrew Morton <[email protected]>