summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2018-05-04 16:28:20 +0200
committerJames Morris <james.morris@microsoft.com>2018-05-04 12:48:54 -0700
commitd47cd9450d3b1fcf6ce7c7022f442a69a7b7322e (patch)
tree3eb1d53c2c89338b4971c95206e0ae1461fcfb99 /net/socket.c
parentaae7cfcbb733cf16f3bc9cbb650673b94d5df75f (diff)
net: hook socketpair() into LSM
Use the newly created LSM-hook for socketpair(). The default hook return-value is 0, so behavior stays the same unless LSMs start using this hook. Acked-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index f10f1d947c78..667a7b397134 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1420,6 +1420,13 @@ int __sys_socketpair(int family, int type, int protocol, int __user *usockvec)
goto out;
}
+ err = security_socket_socketpair(sock1, sock2);
+ if (unlikely(err)) {
+ sock_release(sock2);
+ sock_release(sock1);
+ goto out;
+ }
+
err = sock1->ops->socketpair(sock1, sock2);
if (unlikely(err < 0)) {
sock_release(sock2);