Commit 73ee3eaf authored by Dominik Brodowski's avatar Dominik Brodowski

net: socket: add __compat_sys_setsockopt() helper; remove in-kernel call to compat syscall

Using the net-internal helper __compat_sys_setsockopt() allows us to avoid
the internal calls to the compat_sys_setsockopt() syscall.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent fd4e82f5
...@@ -383,8 +383,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname, ...@@ -383,8 +383,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
return sock_setsockopt(sock, level, optname, optval, optlen); return sock_setsockopt(sock, level, optname, optval, optlen);
} }
COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, static int __compat_sys_setsockopt(int fd, int level, int optname,
char __user *, optval, unsigned int, optlen) char __user *optval, unsigned int optlen)
{ {
int err; int err;
struct socket *sock = sockfd_lookup(fd, &err); struct socket *sock = sockfd_lookup(fd, &err);
...@@ -410,6 +410,12 @@ COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, ...@@ -410,6 +410,12 @@ COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
return err; return err;
} }
COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
char __user *, optval, unsigned int, optlen)
{
return __compat_sys_setsockopt(fd, level, optname, optval, optlen);
}
static int do_get_sock_timeout(struct socket *sock, int level, int optname, static int do_get_sock_timeout(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
...@@ -864,7 +870,7 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args) ...@@ -864,7 +870,7 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
ret = __sys_shutdown(a0, a1); ret = __sys_shutdown(a0, a1);
break; break;
case SYS_SETSOCKOPT: case SYS_SETSOCKOPT:
ret = compat_sys_setsockopt(a0, a1, a[2], ret = __compat_sys_setsockopt(a0, a1, a[2],
compat_ptr(a[3]), a[4]); compat_ptr(a[3]), a[4]);
break; break;
case SYS_GETSOCKOPT: case SYS_GETSOCKOPT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment