Page MenuHomeFreeBSD

Fix double free in case of mount error.
ClosedPublic

Authored by fsu on Feb 27 2019, 11:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 4 2024, 8:20 AM
Unknown Object (File)
Jan 26 2024, 4:46 PM
Unknown Object (File)
Jan 13 2024, 11:22 AM
Unknown Object (File)
Dec 20 2023, 1:40 AM
Unknown Object (File)
Dec 15 2023, 10:05 PM
Unknown Object (File)
Oct 22 2023, 6:25 AM
Unknown Object (File)
Sep 9 2023, 5:45 PM
Unknown Object (File)
Sep 8 2023, 12:46 AM
Subscribers

Details

Summary

It was found, that if cg descriptors bread() will return error, the fs->e2fs_gd and fs->e2fs_contigdirs sb fields will be freed twice.
Immediately after bread() call and at the bottom of the ext2_mountfs() function.
It is not possible to free these in-memory superblocks fields immediately after bread(), because the compute_sb_data() function is used in case of ro/rw remounting.
So, choose the second place and remove free() calls immediately after bread().

Test Plan

Tested manually with problem fs image.
And some ro/rw remount manual tests had place.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

pfg added inline comments.
sys/fs/ext2fs/ext2_vfsops.c
474

Remove "The" from here: we are talking about two things so we cannot use a singular.

This revision is now accepted and ready to land.Feb 27 2019, 2:34 PM
This revision was automatically updated to reflect the committed changes.