msdosfs - Fix panic when mounting msdos filesystems.
authorJoe Talbott <josepht@dragonflybsd.org>
Tue, 7 Sep 2010 04:17:00 +0000 (00:17 -0400)
committerJoe Talbott <josepht@dragonflybsd.org>
Tue, 7 Sep 2010 04:20:33 +0000 (00:20 -0400)
bread()ing different sizes from the same address requires this
flag before b[q]relse() is called.

Discussed-With: dillon

sys/vfs/msdosfs/msdosfs_vfsops.c

index f7abfc6..743279d 100644 (file)
@@ -522,6 +522,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp)
        /*
         * Release the bootsector buffer.
         */
+       bp->b_flags |= B_RELBUF;
        brelse(bp);
        bp = NULL;
 
@@ -543,6 +544,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp)
                                pmp->pm_nxtfree = CLUST_FIRST;
                } else
                        pmp->pm_fsinfo = 0;
+               bp->b_flags |= B_RELBUF;
                brelse(bp);
                bp = NULL;
        }
@@ -605,8 +607,10 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp)
        return 0;
 
 error_exit:
-       if (bp)
+       if (bp) {
+               bp->b_flags |= B_RELBUF;
                brelse(bp);
+       }
        VOP_CLOSE(devvp, ronly ? FREAD : FREAD | FWRITE);
        if (pmp) {
                if (pmp->pm_inusemap)