Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 2003 10:33:52 +1100
From:      Tim Robbins <tjr@freebsd.org>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        Lukas Ertl <l.ertl@univie.ac.at>
Subject:   Re: panic: Most recently used by mount
Message-ID:  <20031109233352.GA53005@wombat.robbins.dropbear.id.au>
In-Reply-To: <20031109213052.GA99478@xor.obsecurity.org>
References:  <20031109175416.Y58774@korben.in.tern> <20031109213052.GA99478@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 09, 2003 at 01:30:52PM -0800, Kris Kennaway wrote:

> On Sun, Nov 09, 2003 at 06:05:06PM +0100, Lukas Ertl wrote:
> 
> > ---
> > panic: Most recently used by mount
> 
> I reported this the other day..tjr has a fix in his p4 branch.

Here's the patch:
(http://perforce.freebsd.org/chv.cgi?CH=41739)

--- kern/vfs_mount.c.old	Mon Nov 10 10:30:14 2003
+++ kern/vfs_mount.c	Sun Nov  9 00:26:03 2003
@@ -700,6 +700,8 @@
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		vrele(vp);
@@ -794,6 +796,8 @@
 		mac_destroy_mount(mp);
 #endif
 		crfree(mp->mnt_cred);
+		lockdestroy(&mp->mnt_lock);
+		mtx_destroy(&mp->mnt_mtx);
 		free(mp, M_MOUNT);
 		vput(vp);
 		goto bad;
@@ -1066,6 +1070,8 @@
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		vrele(vp);
@@ -1147,6 +1153,8 @@
 		mac_destroy_mount(mp);
 #endif
 		crfree(mp->mnt_cred);
+		lockdestroy(&mp->mnt_lock);
+		mtx_destroy(&mp->mnt_mtx);
 		free(mp, M_MOUNT);
 		vput(vp);
 	}
@@ -1587,11 +1595,14 @@
 		free(path, M_MOUNT);
 	if (error != 0) {
 		if (mp != NULL) {
+			mp->mnt_vfc->vfc_refcount--;
 			vfs_unbusy(mp, curthread);
 #ifdef MAC
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		printf("Root mount failed: %d\n", error);
--- nfsclient/nfs_vfsops.c.old	Mon Nov 10 10:31:08 2003
+++ nfsclient/nfs_vfsops.c	Sun Nov  9 00:26:03 2003
@@ -510,8 +510,15 @@
 		printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
 		mp->mnt_vfc->vfc_refcount--;
 		vfs_unbusy(mp, td);
-		if (didalloc)
+		if (didalloc) {
+#ifdef MAC
+			mac_destroy_mount(mp);
+#endif
+			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
+		}
 		FREE(nam, M_SONAME);
 		return (error);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031109233352.GA53005>