From 2db2f17ba0b3e7631312bc56501a4522a328cb81 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Wed, 12 Apr 2023 15:23:41 +0800 Subject: [PATCH] ext4: ext4_put_super: Remove redundant checking for 'sbi->s_journal_bdev' maillist inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I6MMUV CVE: NA Reference: https://www.spinics.net/lists/linux-ext4/msg88237.html -------------------------------- As discussed in [1], 'sbi->s_journal_bdev != sb->s_bdev' will always become true if sbi->s_journal_bdev exists. Filesystem block device and journal block device are both opened with 'FMODE_EXCL' mode, so these two devices can't be same one. Then we can remove the redundant checking 'sbi->s_journal_bdev != sb->s_bdev' if 'sbi->s_journal_bdev' exists. [1] https://lore.kernel.org/lkml/f86584f6-3877-ff18-47a1-2efaa12d18b2@huawei.com/ Signed-off-by: Zhihao Cheng Reviewed-by: Zhang Yi Signed-off-by: Jialin Zhang --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ac7e7396be5a..d87a435adc46 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1289,7 +1289,7 @@ static void ext4_put_super(struct super_block *sb) sync_blockdev(sb->s_bdev); invalidate_bdev(sb->s_bdev); - if (sbi->s_journal_bdev && sbi->s_journal_bdev != sb->s_bdev) { + if (sbi->s_journal_bdev) { sync_blockdev(sbi->s_journal_bdev); ext4_blkdev_remove(sbi); } -- GitLab