summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-09-05 11:13:35 -0600
committerJens Axboe <axboe@kernel.dk>2020-11-23 09:15:15 -0700
commitb713c195d59332277a31a59c91f755e53b5b302b (patch)
treeaff5f0769ec30749c168bcc547fa2b27ca8c86ec /net/socket.c
parentce59fc69b1c2da555706f6b0e77fc099f80e9d0e (diff)
downloadlwn-b713c195d59332277a31a59c91f755e53b5b302b.tar.gz
lwn-b713c195d59332277a31a59c91f755e53b5b302b.zip
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.c15
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;