diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2008-07-05 13:10:10 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2008-07-05 13:10:10 +0000 |
commit | 4f7d1876d532e6607cebd4ea3775094ee8c05dba (patch) | |
tree | fcde383ade7af0060da3dd095039791d9e423bee /sys/nlm | |
parent | e1747bd4de5dbf81642a7f258f8e4942b56ee0c5 (diff) | |
download | src-4f7d1876d532e6607cebd4ea3775094ee8c05dba.tar.gz src-4f7d1876d532e6607cebd4ea3775094ee8c05dba.zip |
Introduce a new lock, hostname_mtx, and use it to synchronize access
to global hostname and domainname variables. Where necessary, copy
to or from a stack-local buffer before performing copyin() or
copyout(). A few uses, such as in cd9660 and daemon_saver, remain
under-synchronized and will require further updates.
Correct a bug in which a failed copyin() of domainname would leave
domainname potentially corrupted.
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=180291
Diffstat (limited to 'sys/nlm')
-rw-r--r-- | sys/nlm/nlm_advlock.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/nlm/nlm_advlock.c b/sys/nlm/nlm_advlock.c index fb8b5a7d51c8..5d1cc83d8110 100644 --- a/sys/nlm/nlm_advlock.c +++ b/sys/nlm/nlm_advlock.c @@ -230,7 +230,9 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl, sa = nmp->nm_nam; memcpy(&ss, sa, sa->sa_len); sa = (struct sockaddr *) &ss; + mtx_lock(&hostname_mtx); strcpy(servername, nmp->nm_hostname); + mtx_unlock(&hostname_mtx); fhlen = np->n_fhsize; memcpy(&fh.fh_bytes, np->n_fhp, fhlen); timo.tv_sec = nmp->nm_timeo / NFS_HZ; @@ -1218,7 +1220,9 @@ nlm_init_lock(struct flock *fl, int flags, int svid, return (EOVERFLOW); } + mtx_lock(&hostname_mtx); snprintf(oh_space, 32, "%d@%s", svid, hostname); + mtx_unlock(&hostname_mtx); oh_len = strlen(oh_space); memset(lock, 0, sizeof(*lock)); |