fs: ext4fs: Add initialization failure recovery path in ext4fs_write
PATCH 1/1 fs: ext4fs: Add initialization failure recovery path in ext4fs_write
Don't invoke ext4fs_deinit() in ext4fs_write() if the failure occurs during initialization. It would result in a crash since ext4fs_init() has already done that.
Signed-off-by Tony Dinh <[email protected]>
--- fs/ext4/ext4_write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/ext4_write.c +3 -1
@@ -877,7 +877,8 @@ int ext4fs_write(const char *fname, const char *buffer,if (ext4fs_init () !=0 ) {printf ("error in File System init\n" ); - goto fail; +/* Skip ext4fs_deinit since ext4fs_init() already done that */ + goto fail_init; } missing_feat =le32_to_cpu (fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP ;
@@ -1050,6 +1051,7 @@ int ext4fs_write(const char *fname, const char *buffer,return 0 ; fail:ext4fs_deinit (); +fail_init:free (inode_buffer);free (g_parent_inode);free (temp_ptr);
Signature · 1 line
2.39.5
Quoted 5 lines · Tony Dinh
Don't invoke
ext4fs_deinit()inext4fs_write()if the failure occurs during initialization. It would result in a crash sinceext4fs_init()has already done that.Signed-off-by Tony Dinh <[email protected]>
Reviewed-by Tom Rini <[email protected]>
Signature · 1 line
Tom
Quoted 5 lines · Tony Dinh
Don't invoke
ext4fs_deinit()inext4fs_write()if the failure occurs during initialization. It would result in a crash sinceext4fs_init()has already done that.
Applied to u-boot/next, thanks!
[1/1] fs: ext4fs: Add initialization failure recovery path in ext4fs_write
commit: 1f8fd9d37d69ecc269943a273d3bca4c1be2384e
Signature · 1 line
Tom