Date: Mon, 17 Nov 2003 11:06:06 +0100 From: Pawel Jakub Dawidek <nick@garage.freebsd.pl> To: freebsd-current@freebsd.org Subject: Panic after mount() fail. Message-ID: <20031117100606.GK85962@garage.freebsd.pl>
next in thread | raw e-mail | index | archive | help
--WeDu0lr7bteb/II5
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hello.
There is a problem with mount(2) failures. It can cause panics.
How-to-repeat.
# dd if=3D/dev/random of=3D/test.img bs=3D1m count=3D8
# mdconfig -a -t vnode -f /test.img -u 25
# mkdir -p /mnt/test
# mount /dev/md25 /mnt/test
(fail)
# mount /dev/md25 /mnt/test
(panic "Memory modified after free ...")
This is because on failure mutex is not destroyed.
Patch:
--- vfs_mount.c.orig Sun Nov 16 15:46:56 2003
+++ vfs_mount.c Sun Nov 16 15:21:48 2003
@@ -1061,6 +1061,7 @@ update:
vfs_unbusy(mp, td);
else {
mp->mnt_vfc->vfc_refcount--;
+ mtx_destroy(&mp->mnt_mtx);
vfs_unbusy(mp, td);
#ifdef MAC
mac_destroy_mount(mp);
@@ -1142,6 +1143,7 @@ update:
vp->v_iflag &=3D ~VI_MOUNT;
VI_UNLOCK(vp);
mp->mnt_vfc->vfc_refcount--;
+ mtx_destroy(&mp->mnt_mtx);
vfs_unbusy(mp, td);
#ifdef MAC
mac_destroy_mount(mp);
--=20
Pawel Jakub Dawidek pawel@dawidek.net
UNIX Systems Programmer/Administrator http://garage.freebsd.pl
Am I Evil? Yes, I Am! http://cerber.sourceforge.net
--WeDu0lr7bteb/II5
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iQCVAwUBP7idjj/PhmMH/Mf1AQHrtwQAlb7IdyP/Wium3g4F/PB0icGd3cMaJ+TG
gSX6NZqtk4vhgar7I4AZfhNGt/e4o2kSyjnBonoF0dfRo2EQjcUOCOhjX5CsW80m
uBAfF196bh3oazT/qjstHtfOr/ipPwJ1f19H0KB95lLgFroBL6gujx5dSRnRRrRz
3ASpG8ON0hM=
=JAAE
-----END PGP SIGNATURE-----
--WeDu0lr7bteb/II5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031117100606.GK85962>
