diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-10-04 18:47:09 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-10-04 18:47:09 +0000 |
commit | 7a3405d76f8c2f5f05f71b476714ec74a8dea30c (patch) | |
tree | d531cfdfb612b2e4ed34f2feab102563f8d4d741 | |
parent | a5001a325d153839f76181e876b5a5de19b0b086 (diff) |
vrele swap and/or root vnode should we fail during mountroot; found by mpech@ and tedu@ ok
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 5881672e7d2..dcaacc3b195 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.59 2003/08/25 23:26:55 tedu Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.60 2003/10/04 18:47:08 mickey Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -119,18 +119,27 @@ ffs_mountroot() /* * Get vnodes for swapdev and rootdev. */ + swapdev_vp = NULL; if ((error = bdevvp(swapdev, &swapdev_vp)) || (error = bdevvp(rootdev, &rootvp))) { printf("ffs_mountroot: can't setup bdevvp's"); + if (swapdev_vp) + vrele(swapdev_vp); return (error); } - if ((error = vfs_rootmountalloc("ffs", "root_device", &mp)) != 0) + if ((error = vfs_rootmountalloc("ffs", "root_device", &mp)) != 0) { + vrele(swapdev_vp); + vrele(rootvp); return (error); + } + if ((error = ffs_mountfs(rootvp, mp, p)) != 0) { mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, p); free(mp, M_MOUNT); + vrele(swapdev_vp); + vrele(rootvp); return (error); } simple_lock(&mountlist_slock); |