From 32903c86e7f19c19bb05b53e86a54bd777f2f7e7 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 29 Mar 2004 01:55:32 +0000 Subject: [PATCH] Conditionally acquire Giant when entering the socket layer via file descriptor operations based on debug.mpsafenet, rather than acquiring Giant unconditionally. --- sys/kern/sys_socket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 879e83d9e3e8..7566a56e45a3 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -79,16 +79,16 @@ soo_read(fp, uio, active_cred, flags, td) struct socket *so = fp->f_data; int error; - mtx_lock(&Giant); + NET_LOCK_GIANT(); #ifdef MAC error = mac_check_socket_receive(active_cred, so); if (error) { - mtx_unlock(&Giant); + NET_UNLOCK_GIANT(); return (error); } #endif error = so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0); - mtx_unlock(&Giant); + NET_UNLOCK_GIANT(); return (error); } @@ -104,17 +104,17 @@ soo_write(fp, uio, active_cred, flags, td) struct socket *so = fp->f_data; int error; - mtx_lock(&Giant); + NET_LOCK_GIANT(); #ifdef MAC error = mac_check_socket_send(active_cred, so); if (error) { - mtx_unlock(&Giant); + NET_UNLOCK_GIANT(); return (error); } #endif error = so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0, uio->uio_td); - mtx_unlock(&Giant); + NET_UNLOCK_GIANT(); return (error); }