diff options
author | Grigoriy Orlov <gluk@cvs.openbsd.org> | 2001-04-22 21:33:47 +0000 |
---|---|---|
committer | Grigoriy Orlov <gluk@cvs.openbsd.org> | 2001-04-22 21:33:47 +0000 |
commit | 17ca96bd7a4844ec25ddf4038f6fdbda8560831a (patch) | |
tree | 13cbf3d4216263e98c763cad9a2bd2350d983beb /sys/ufs/ffs/ffs_vfsops.c | |
parent | 1692fa75790f396f9ae7bb4438a14c0cfb2efc16 (diff) |
Free fs->fs_contigdirs array only on successful rw->ro update. This
fixes "duplicated free" panic. Update file system from read-write to
read-only freed memory but may fail later if file system busy.
deraadt@ ok.
Diffstat (limited to 'sys/ufs/ffs/ffs_vfsops.c')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 88fcc43e0fd..ff73d0590a4 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.40 2001/04/19 16:22:17 gluk Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.41 2001/04/22 21:33:46 gluk Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -194,7 +194,6 @@ ffs_mount(mp, path, data, ndp, p) mp->mnt_flag &= ~MNT_SOFTDEP; } else error = ffs_flushfiles(mp, flags, p); - free(fs->fs_contigdirs, M_WAITOK); ronly = 1; } @@ -408,6 +407,8 @@ success: fs->fs_ronly = ronly; fs->fs_clean = ronly && (fs->fs_flags & FS_UNCLEAN) == 0 ? 1 : 0; + if (ronly) + free(fs->fs_contigdirs, M_WAITOK); } if (!ronly) { if (mp->mnt_flag & MNT_SOFTDEP) @@ -489,6 +490,7 @@ ffs_reload(mountp, cred, p) */ newfs->fs_csp = fs->fs_csp; newfs->fs_maxcluster = fs->fs_maxcluster; + newfs->fs_ronly = fs->fs_ronly; bcopy(newfs, fs, (u_int)fs->fs_sbsize); if (fs->fs_sbsize < SBSIZE) bp->b_flags |= B_INVAL; |