svn commit: r359369 - stable/12/sys/kern
Mark Johnston
markj at FreeBSD.org
Fri Mar 27 17:04:59 UTC 2020
Author: markj
Date: Fri Mar 27 17:04:46 2020
New Revision: 359369
URL: https://svnweb.freebsd.org/changeset/base/359369
Log:
MFC r359184:
Lock the socket in soo_stat().
Modified:
stable/12/sys/kern/sys_socket.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/sys_socket.c
==============================================================================
--- stable/12/sys/kern/sys_socket.c Fri Mar 27 16:05:37 2020 (r359368)
+++ stable/12/sys/kern/sys_socket.c Fri Mar 27 17:04:46 2020 (r359369)
@@ -287,9 +287,7 @@ soo_stat(struct file *fp, struct stat *ub, struct ucre
struct thread *td)
{
struct socket *so = fp->f_data;
-#ifdef MAC
int error;
-#endif
bzero((caddr_t)ub, sizeof (*ub));
ub->st_mode = S_IFSOCK;
@@ -298,6 +296,7 @@ soo_stat(struct file *fp, struct stat *ub, struct ucre
if (error)
return (error);
#endif
+ SOCK_LOCK(so);
if (!SOLISTENING(so)) {
struct sockbuf *sb;
@@ -320,7 +319,9 @@ soo_stat(struct file *fp, struct stat *ub, struct ucre
}
ub->st_uid = so->so_cred->cr_uid;
ub->st_gid = so->so_cred->cr_gid;
- return (*so->so_proto->pr_usrreqs->pru_sense)(so, ub);
+ error = so->so_proto->pr_usrreqs->pru_sense(so, ub);
+ SOCK_UNLOCK(so);
+ return (error);
}
/*
More information about the svn-src-stable
mailing list