summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2002-12-21 20:55:34 +0000
committerdillon <dillon@FreeBSD.org>2002-12-21 20:55:34 +0000
commit63da09d1e62bd16665dbeae5bd1bc3b67e6d5b98 (patch)
tree60a338040096f30050db4016ace692f9886bbbe8 /sys/nfsclient
parentadc4b142acadf80c974cb6c97c90125b62d083a0 (diff)
downloadFreeBSD-src-63da09d1e62bd16665dbeae5bd1bc3b67e6d5b98.zip
FreeBSD-src-63da09d1e62bd16665dbeae5bd1bc3b67e6d5b98.tar.gz
do not try to free a mountpoint that we did not allocate.
X-MFC after: immediately
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vfsops.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 8b7195a..51f6330 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -543,12 +543,16 @@ nfs_mountdiskless(char *path, char *which, int mountflag,
struct mount *mp;
struct sockaddr *nam;
int error;
+ int didalloc = 0;
mp = *mpp;
- if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) {
- printf("nfs_mountroot: NFS not configured");
- return (error);
+ if (mp == NULL) {
+ if ((error = vfs_rootmountalloc("nfs", path, &mp)) != 0) {
+ printf("nfs_mountroot: NFS not configured");
+ return (error);
+ }
+ didalloc = 1;
}
mp->mnt_kern_flag = 0;
@@ -559,7 +563,8 @@ nfs_mountdiskless(char *path, char *which, int mountflag,
printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp, td);
- free(mp, M_MOUNT);
+ if (didalloc)
+ free(mp, M_MOUNT);
FREE(nam, M_SONAME);
return (error);
}
OpenPOWER on IntegriCloud