dev_ioctl should return -EINVAL for unknown ioctl instead of -ENOTTY
Subsystems (2)
PATCH 1/1 dev_ioctl should return -EINVAL for unknown ioctl instead of -ENOTTY
The patch is against 3.1-rc3.
--- net/core/dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/dev.c +1 -1
@@ -5092,7 +5092,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)/* Take care of Wireless Extensions */ if (cmd >=SIOCIWFIRST && cmd <=SIOCIWLAST )return wext_handle_ioctl (net, &ifr, cmd, arg); -return -ENOTTY ; +return -EINVAL ; } }
Signature · 1 line
1.7.1
Quoted 12 lines · Wang Sheng-Hui
The patch is against 3.1-rc3.
Signed-off-by Wang Sheng-Hui <[email protected]>--- net/core/dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/core/dev.c +0
-0
net/core/dev.c int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · line 5098
Quoted 8 lines
net/core/dev.c +1
-1@@ -5092,7 +5092,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)/* Take care of Wireless Extensions */ if (cmd >=SIOCIWFIRST && cmd <=SIOCIWLAST )return wext_handle_ioctl (net, &ifr, cmd, arg); -return -ENOTTY ; +return -EINVAL ; } }
Whereas, Linus Torvalds wrote in <[email protected]>:
[...]
Quoted 5 lines
The correct error code for "I don't understand this ioctl" is ENOTTY. The naming may be odd, but you should think of that error value as a "unrecognized ioctl number, you're feeding me random numbers that I don't understand and I assume for historical reasons that you tried to do some tty operation on me".
[...]
(Not that we are consistent about using ENOTTY in networking now.)
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 30 lines · Ben Hutchings
Quoted 12 lines · Wang Sheng-Hui
The patch is against 3.1-rc3.
Signed-off-by Wang Sheng-Hui <[email protected]>--- net/core/dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/core/dev.c +0
-0net/core/dev.c int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · line 5098
Quoted 8 lines
net/core/dev.c +1
-1@@ -5092,7 +5092,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)/* Take care of Wireless Extensions */ if (cmd >=SIOCIWFIRST && cmd <=SIOCIWLAST )return wext_handle_ioctl (net, &ifr, cmd, arg); -return -ENOTTY ; +return -EINVAL ; } }Whereas, Linus Torvalds wrote in <[email protected]>:
[...]Quoted 5 lines
The correct error code for "I don't understand this ioctl" is ENOTTY. The naming may be odd, but you should think of that error value as a "unrecognized ioctl number, you're feeding me random numbers that I don't understand and I assume for historical reasons that you tried to do some tty operation on me".
Quoted 6 lines
[...]
(Not that we are consistent about using ENOTTY in networking now.)
Ben.
Got it. Thanks.