mirror of
https://github.com/joel16/android_kernel_sony_msm8994_rework.git
synced 2024-11-24 12:29:53 +00:00
net: change return values from -EACCES to -EPERM
Change return value from -EACCES to -EPERM when the permission check fails. Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e0c7a4a1a6
commit
bf5b30b8a4
@ -58,7 +58,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
switch (cmd) {
|
||||
case BNEPCONNADD:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&ca, argp, sizeof(ca)))
|
||||
return -EFAULT;
|
||||
@ -84,7 +84,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
|
||||
case BNEPCONNDEL:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&cd, argp, sizeof(cd)))
|
||||
return -EFAULT;
|
||||
|
@ -72,7 +72,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
switch (cmd) {
|
||||
case CMTPCONNADD:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&ca, argp, sizeof(ca)))
|
||||
return -EFAULT;
|
||||
@ -97,7 +97,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
|
||||
case CMTPCONNDEL:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&cd, argp, sizeof(cd)))
|
||||
return -EFAULT;
|
||||
|
@ -490,7 +490,7 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
|
||||
switch (cmd) {
|
||||
case HCISETRAW:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
|
||||
return -EPERM;
|
||||
@ -510,12 +510,12 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
|
||||
|
||||
case HCIBLOCKADDR:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_sock_blacklist_add(hdev, (void __user *) arg);
|
||||
|
||||
case HCIUNBLOCKADDR:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_sock_blacklist_del(hdev, (void __user *) arg);
|
||||
|
||||
default:
|
||||
@ -546,22 +546,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd,
|
||||
|
||||
case HCIDEVUP:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_dev_open(arg);
|
||||
|
||||
case HCIDEVDOWN:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_dev_close(arg);
|
||||
|
||||
case HCIDEVRESET:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_dev_reset(arg);
|
||||
|
||||
case HCIDEVRESTAT:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_dev_reset_stat(arg);
|
||||
|
||||
case HCISETSCAN:
|
||||
@ -573,7 +573,7 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd,
|
||||
case HCISETACLMTU:
|
||||
case HCISETSCOMTU:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
return hci_dev_cmd(cmd, argp);
|
||||
|
||||
case HCIINQUIRY:
|
||||
|
@ -56,7 +56,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
switch (cmd) {
|
||||
case HIDPCONNADD:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&ca, argp, sizeof(ca)))
|
||||
return -EFAULT;
|
||||
@ -91,7 +91,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||
|
||||
case HIDPCONNDEL:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&cd, argp, sizeof(cd)))
|
||||
return -EFAULT;
|
||||
|
@ -725,7 +725,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||
break;
|
||||
|
||||
case SIOCSIFFLAGS:
|
||||
ret = -EACCES;
|
||||
ret = -EPERM;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
goto out;
|
||||
break;
|
||||
@ -733,7 +733,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||
case SIOCSIFBRDADDR: /* Set the broadcast address */
|
||||
case SIOCSIFDSTADDR: /* Set the destination address */
|
||||
case SIOCSIFNETMASK: /* Set the netmask for the interface */
|
||||
ret = -EACCES;
|
||||
ret = -EPERM;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
goto out;
|
||||
ret = -EINVAL;
|
||||
|
@ -601,7 +601,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
if (!capable(CAP_NET_BIND_SERVICE)) {
|
||||
dev_put(dev);
|
||||
release_sock(sk);
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
}
|
||||
nr->user_addr = addr->fsa_digipeater[0];
|
||||
nr->source_addr = addr->fsa_ax25.sax25_call;
|
||||
|
Loading…
Reference in New Issue
Block a user