diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-09-05 20:13:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-04 13:39:17 +0300 |
commit | 069ac28d92432dd7cdac0a2c141a1b3b8d4330d5 (patch) | |
tree | 9521d8de2e3201033f2dd92fff3a36d47ad904ce /net/socket.c | |
parent | 0b8cd5d814cb53d4109d2ba5e73dab38bf49a3b7 (diff) | |
download | linux-069ac28d92432dd7cdac0a2c141a1b3b8d4330d5.tar.xz |
net: provide __sys_shutdown_sock() that takes a socket
[ Upstream commit b713c195d59332277a31a59c91f755e53b5b302b ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 bcf68b150fe2..c11b5239ef05 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2181,6 +2181,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; @@ -2188,9 +2199,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; |