Skip to content

Commit c4d1322

Browse files
chaseyutytso
authored andcommitted
ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
freeze_bdev() can fail due to a lot of reasons, it needs to check its reason before later process. Fixes: 783d948 ("ext4: add EXT4_IOC_GOINGDOWN ioctl") Cc: [email protected] Signed-off-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent f3c1c42 commit c4d1322

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/ext4/ioctl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ static int ext4_shutdown(struct super_block *sb, unsigned long arg)
797797
{
798798
struct ext4_sb_info *sbi = EXT4_SB(sb);
799799
__u32 flags;
800+
int ret;
800801

801802
if (!capable(CAP_SYS_ADMIN))
802803
return -EPERM;
@@ -815,7 +816,9 @@ static int ext4_shutdown(struct super_block *sb, unsigned long arg)
815816

816817
switch (flags) {
817818
case EXT4_GOING_FLAGS_DEFAULT:
818-
freeze_bdev(sb->s_bdev);
819+
ret = freeze_bdev(sb->s_bdev);
820+
if (ret)
821+
return ret;
819822
set_bit(EXT4_FLAGS_SHUTDOWN, &sbi->s_ext4_flags);
820823
thaw_bdev(sb->s_bdev);
821824
break;

0 commit comments

Comments
 (0)