diff mbox series

[04/97] SCAFFOLD: Move sock_graft out of sock.h

Message ID 20190228221933.2551-5-casey@schaufler-ca.com (mailing list archive)
State New, archived
Headers show
Series LSM: Complete module stacking | expand

Commit Message

Casey Schaufler Feb. 28, 2019, 10:18 p.m. UTC
Move sock_graft out of sock.h so that sock.h doesn't need security.h.
This makes Casey's life easier as lots less recompiles after a change
to security.h. DO NOT TAKE THIS PATCH!

Signed-off-by: Casey Schaufler <caey@schaufler-ca.com>
---
 include/net/sock.h | 14 ++------------
 net/socket.c       | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/include/net/sock.h b/include/net/sock.h
index 2b229f7be8eb..2beeda35e39f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -51,7 +51,7 @@ 
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>	/* struct sk_buff */
 #include <linux/mm.h>
-#include <linux/security.h>
+//CBS #include <linux/security.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/page_counter.h>
@@ -1800,17 +1800,7 @@  static inline void sock_orphan(struct sock *sk)
 	write_unlock_bh(&sk->sk_callback_lock);
 }
 
-static inline void sock_graft(struct sock *sk, struct socket *parent)
-{
-	WARN_ON(parent->sk);
-	write_lock_bh(&sk->sk_callback_lock);
-	rcu_assign_pointer(sk->sk_wq, parent->wq);
-	parent->sk = sk;
-	sk_set_socket(sk, parent);
-	sk->sk_uid = SOCK_INODE(parent)->i_uid;
-	security_sock_graft(sk, parent);
-	write_unlock_bh(&sk->sk_callback_lock);
-}
+void sock_graft(struct sock *sk, struct socket *parent);
 
 kuid_t sock_i_uid(struct sock *sk);
 unsigned long sock_i_ino(struct sock *sk);
diff --git a/net/socket.c b/net/socket.c
index e89884e2197b..d5da935302a7 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -3425,3 +3425,20 @@  u32 kernel_sock_ip_overhead(struct sock *sk)
 	}
 }
 EXPORT_SYMBOL(kernel_sock_ip_overhead);
+
+//CBS - HACK TO SPEED COMPILES
+
+void sock_graft(struct sock *sk, struct socket *parent)
+{
+	WARN_ON(parent->sk);
+	write_lock_bh(&sk->sk_callback_lock);
+	rcu_assign_pointer(sk->sk_wq, parent->wq);
+	parent->sk = sk;
+	sk_set_socket(sk, parent);
+	sk->sk_uid = SOCK_INODE(parent)->i_uid;
+	security_sock_graft(sk, parent);
+	write_unlock_bh(&sk->sk_callback_lock);
+}
+EXPORT_SYMBOL(sock_graft);
+
+//CBS - HACK TO SPEED COMPILES