networking: inappropriate ioctl operation should return ENOTTY

ioctl() calls against a socket with an inappropriate ioctl operation
are incorrectly returning EINVAL rather than ENOTTY:

[ENOTTY]
Inappropriate I/O control operation.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=33992

Signed-off-by: Lifeng Sun <lifongsun@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Lifeng Sun and committed by David S. Miller 41c31f31 983960b1

+3 -3
+3 -3
net/core/dev.c
··· 4773 4773 * is never reached 4774 4774 */ 4775 4775 WARN_ON(1); 4776 - err = -EINVAL; 4776 + err = -ENOTTY; 4777 4777 break; 4778 4778 4779 4779 } ··· 5041 5041 /* Set the per device memory buffer space. 5042 5042 * Not applicable in our case */ 5043 5043 case SIOCSIFLINK: 5044 - return -EINVAL; 5044 + return -ENOTTY; 5045 5045 5046 5046 /* 5047 5047 * Unknown or private ioctl. ··· 5062 5062 /* Take care of Wireless Extensions */ 5063 5063 if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) 5064 5064 return wext_handle_ioctl(net, &ifr, cmd, arg); 5065 - return -EINVAL; 5065 + return -ENOTTY; 5066 5066 } 5067 5067 } 5068 5068