diff options
author | 2001-04-22 21:33:46 +0000 | |
---|---|---|
committer | 2001-04-22 21:33:46 +0000 | |
commit | 9b58747168a3c9e06f79a01c4b55555bfcf258b5 (patch) | |
tree | 156fb44dd1177297625a2fe147600f1ecf28190f | |
parent | Fix spl handling in ipfilter ioctl interface. Work by aaron@ and me. (diff) | |
download | wireguard-openbsd-9b58747168a3c9e06f79a01c4b55555bfcf258b5.tar.xz wireguard-openbsd-9b58747168a3c9e06f79a01c4b55555bfcf258b5.zip |
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.
-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; |