public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: stable@vger•kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	patches@lists•linux.dev, netdev@vger•kernel.org,
	"David S. Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>, Jens Axboe <axboe@kernel•dk>
Subject: [PATCH 5.10 09/63] net: provide __sys_shutdown_sock() that takes a socket
Date: Tue,  3 Jan 2023 09:13:39 +0100	[thread overview]
Message-ID: <20230103081309.123931742@linuxfoundation.org> (raw)
In-Reply-To: <20230103081308.548338576@linuxfoundation.org>

From: Jens Axboe <axboe@kernel•dk>

[ 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>
---
 include/linux/socket.h |    1 +
 net/socket.c           |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -436,5 +436,6 @@ extern int __sys_getpeername(int fd, str
 			     int __user *usockaddr_len);
 extern int __sys_socketpair(int family, int type, int protocol,
 			    int __user *usockvec);
+extern int __sys_shutdown_sock(struct socket *sock, int how);
 extern int __sys_shutdown(int fd, int how);
 #endif /* _LINUX_SOCKET_H */
--- a/net/socket.c
+++ b/net/socket.c
@@ -2181,6 +2181,17 @@ SYSCALL_DEFINE5(getsockopt, int, fd, int
  *	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;



           reply	other threads:[~2023-01-03  8:15 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20230103081308.548338576@linuxfoundation.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230103081309.123931742@linuxfoundation.org \
    --to=gregkh@linuxfoundation$(echo .)org \
    --cc=axboe@kernel$(echo .)dk \
    --cc=davem@davemloft$(echo .)net \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=patches@lists$(echo .)linux.dev \
    --cc=stable@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox