mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
[ Upstream commitc4d13222af
] freeze_bdev() can fail due to a lot of reasons, it needs to check its reason before later process. Fixes:783d948544
("ext4: add EXT4_IOC_GOINGDOWN ioctl") Cc: stable@kernel.org Signed-off-by: Chao Yu <chao@kernel.org> Link: https://lore.kernel.org/r/20230606073203.1310389-1-chao@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e697f466bf
commit
9cc6d59cd3
1 changed files with 4 additions and 1 deletions
|
@ -561,6 +561,7 @@ static int ext4_shutdown(struct super_block *sb, unsigned long arg)
|
|||
{
|
||||
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
||||
__u32 flags;
|
||||
struct super_block *ret;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -579,7 +580,9 @@ static int ext4_shutdown(struct super_block *sb, unsigned long arg)
|
|||
|
||||
switch (flags) {
|
||||
case EXT4_GOING_FLAGS_DEFAULT:
|
||||
freeze_bdev(sb->s_bdev);
|
||||
ret = freeze_bdev(sb->s_bdev);
|
||||
if (IS_ERR(ret))
|
||||
return PTR_ERR(ret);
|
||||
set_bit(EXT4_FLAGS_SHUTDOWN, &sbi->s_ext4_flags);
|
||||
thaw_bdev(sb->s_bdev, sb);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue