diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-09-05 20:13:35 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-11-23 19:15:15 +0300 |
commit | b713c195d59332277a31a59c91f755e53b5b302b (patch) | |
tree | aff5f0769ec30749c168bcc547fa2b27ca8c86ec /net/socket.c | |
parent | ce59fc69b1c2da555706f6b0e77fc099f80e9d0e (diff) | |
download | linux-b713c195d59332277a31a59c91f755e53b5b302b.tar.xz |
net: provide __sys_shutdown_sock() that takes a socket
No functional changes in this patch, needed to provide io_uring support
for shutdown(2).
Cc: netdev@vger.kernel.org
Cc: David S. Miller <davem@davemloft.net>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/socket.c b/net/socket.c index 6e6cccc2104f..4b615c719765 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2192,6 +2192,17 @@ SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, * Shutdown a socket. */ +int __sys_shutdown_sock(struct socket *sock, int how) +{ + int err; + + err = security_socket_shutdown(sock, how); + if (!err) + err = sock->ops->shutdown(sock, how); + + return err; +} + int __sys_shutdown(int fd, int how) { int err, fput_needed; @@ -2199,9 +2210,7 @@ int __sys_shutdown(int fd, int how) sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock != NULL) { - err = security_socket_shutdown(sock, how); - if (!err) - err = sock->ops->shutdown(sock, how); + err = __sys_shutdown_sock(sock, how); fput_light(sock->file, fput_needed); } return err; |