summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-05-18 19:34:54 +0000
committerrwatson <rwatson@FreeBSD.org>2007-05-18 19:34:54 +0000
commit3b7f8bde24f43dadf4fdc9d58ec8bb1537ca893c (patch)
tree8b2fba9e20aa3492b27de6be36309a7ad06e3b00
parentc0c37f7027050a1df3618149e05ab8685a6a7aae (diff)
downloadFreeBSD-src-3b7f8bde24f43dadf4fdc9d58ec8bb1537ca893c.zip
FreeBSD-src-3b7f8bde24f43dadf4fdc9d58ec8bb1537ca893c.tar.gz
In nfs_down(), if rep can be NULL, which we test for, then we should
lock and unlock conditionally, not just set the flag on it conditionally. In practice, this bug couldn't manifest, as in the current revision of the code, no callers pass a NULL rep. CID: 1416 Found with: Coverity Prevent(tm)
-rw-r--r--sys/nfsclient/nfs_socket.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c
index 6036050..039d0e1 100644
--- a/sys/nfsclient/nfs_socket.c
+++ b/sys/nfsclient/nfs_socket.c
@@ -1888,10 +1888,11 @@ nfs_down(rep, nmp, td, msg, error, flags)
} else
mtx_unlock(&nmp->nm_mtx);
#endif
- mtx_lock(&rep->r_mtx);
- if (rep)
+ if (rep != NULL) {
+ mtx_lock(&rep->r_mtx);
rep->r_flags |= R_TPRINTFMSG;
- mtx_unlock(&rep->r_mtx);
+ mtx_unlock(&rep->r_mtx);
+ }
nfs_msg(td, nmp->nm_mountp->mnt_stat.f_mntfromname, msg, error);
}
OpenPOWER on IntegriCloud