1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-31 16:57:10 +00:00

Fix double free in case of mount error.

Reported by:    Christopher Krah <krah@protonmail.com>
Reported as:    FS-9-EXT3-2: Denial Of Service in nmount-5 (vm_fault_hold)
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19385
This commit is contained in:
Fedor Uporov 2019-03-04 11:33:49 +00:00
parent 3eed9f20d4
commit 9441309ae0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344757

View File

@ -614,8 +614,12 @@ ext2_compute_sb_data(struct vnode *devvp, struct ext2fs *es,
fsbtodb(fs, ext2_cg_location(fs, i)),
fs->e2fs_bsize, NOCRED, &bp);
if (error) {
free(fs->e2fs_contigdirs, M_EXT2MNT);
free(fs->e2fs_gd, M_EXT2MNT);
/*
* fs->e2fs_gd and fs->e2fs_contigdirs
* will be freed later by the caller,
* because this function could be called from
* MNT_UPDATE path.
*/
brelse(bp);
return (error);
}