From fb721e97bd9b3dac0c61346c71d0745ec2317c93 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 28 Jul 2023 14:15:07 -0400 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...k-return-value-of-freeze_bdev-in-ext.patch | 48 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 queue-4.19/ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch diff --git a/queue-4.19/ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch b/queue-4.19/ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch new file mode 100644 index 00000000000..5e4a9673960 --- /dev/null +++ b/queue-4.19/ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch @@ -0,0 +1,48 @@ +From 826868a6fbf2d4872ac66c84b4113c40eacda129 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jun 2023 15:32:03 +0800 +Subject: ext4: fix to check return value of freeze_bdev() in ext4_shutdown() + +From: Chao Yu + +[ Upstream commit c4d13222afd8a64bf11bc7ec68645496ee8b54b9 ] + +freeze_bdev() can fail due to a lot of reasons, it needs to check its +reason before later process. + +Fixes: 783d94854499 ("ext4: add EXT4_IOC_GOINGDOWN ioctl") +Cc: stable@kernel.org +Signed-off-by: Chao Yu +Link: https://lore.kernel.org/r/20230606073203.1310389-1-chao@kernel.org +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/ioctl.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c +index b930e8d559d41..43e036f0b661d 100644 +--- a/fs/ext4/ioctl.c ++++ b/fs/ext4/ioctl.c +@@ -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; +-- +2.39.2 + diff --git a/queue-4.19/series b/queue-4.19/series index 37f4bfb4422..48b06df8c1a 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -234,3 +234,4 @@ ftrace-store-the-order-of-pages-allocated-in-ftrace_.patch ftrace-fix-possible-warning-on-checking-all-pages-us.patch scsi-qla2xxx-fix-inconsistent-format-argument-type-i.patch scsi-qla2xxx-array-index-may-go-out-of-bound.patch +ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch -- 2.47.3