summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 15837d3..8a6176d 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1777,19 +1777,22 @@ fgetsock(struct thread *td, int fd, struct socket **spp, u_int *fflagp)
*spp = (struct socket *)fp->f_data;
if (fflagp)
*fflagp = fp->f_flag;
+ SOCK_LOCK(*spp);
soref(*spp);
+ SOCK_UNLOCK(*spp);
}
FILEDESC_UNLOCK(td->td_proc->p_fd);
return(error);
}
/*
- * Drop the reference count on the the socket and XXX release the SX lock in
- * the future. The last reference closes the socket.
+ * Drop the reference count on the the socket and release the lock.
+ * The last reference closes the socket. The socket must be unlocked.
*/
void
fputsock(struct socket *so)
{
+ SOCK_LOCK(so);
sorele(so);
}
OpenPOWER on IntegriCloud