summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_sockbuf.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-13 02:50:07 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-13 02:50:07 +0000
commitf1bc833e9552e6874a5343bfd4a0b2999a185b42 (patch)
treeb82bb2c8445f7117f831d6287d086e05ebd1953e /sys/kern/uipc_sockbuf.c
parentb173c880aa20391adf396c098a510e93c583ec02 (diff)
downloadFreeBSD-src-f1bc833e9552e6874a5343bfd4a0b2999a185b42.zip
FreeBSD-src-f1bc833e9552e6874a5343bfd4a0b2999a185b42.tar.gz
Socket MAC labels so_label and so_peerlabel are now protected by
SOCK_LOCK(so): - Hold socket lock over calls to MAC entry points reading or manipulating socket labels. - Assert socket lock in MAC entry point implementations. - When externalizing the socket label, first make a thread-local copy while holding the socket lock, then release the socket lock to externalize to userspace.
Diffstat (limited to 'sys/kern/uipc_sockbuf.c')
-rw-r--r--sys/kern/uipc_sockbuf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 0d75abe..7dbc19d 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -209,7 +209,9 @@ sonewconn(head, connstatus)
so->so_timeo = head->so_timeo;
so->so_cred = crhold(head->so_cred);
#ifdef MAC
+ SOCK_LOCK(head);
mac_create_socket_from_socket(head, so);
+ SOCK_UNLOCK(head);
#endif
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
(*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
OpenPOWER on IntegriCloud