f2fs: fix null reference error when checking end of zone
PATCH 1/1 f2fs: fix null reference error when checking end of zone
From: Daejun Park <[email protected]>
[ Upstream commit c82bc1ab2a8a5e73d9728e80c4c2ed87e8921a38 ]
This patch fixes a potentially null pointer being accessed by is_end_zone_blkaddr() that checks the last block of a zone when f2fs is mounted as a single device.
Fixes e067dc3c6b9c ("f2fs: maintain six open zones for zoned devices")
Signed-off-by Daejun Park <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Reviewed-by Daeho Jeong <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
[ Resolve minor conflicts ]
Signed-off-by Bin Lan <[email protected]>
--- fs/f2fs/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/data.c +3 -1
@@ -924,6 +924,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)#ifdef CONFIG_BLK_DEV_ZONED static bool is_end_zone_blkaddr (struct f2fs_sb_info *sbi,block_t blkaddr) { +struct block_device *bdev = sbi->sb->s_bdev;int devi =0 ;if (f2fs_is_multi_device (sbi)) {
@@ -934,8 +935,9 @@ static bool is_end_zone_blkaddr(struct f2fs_sb_info *sbi, block_t blkaddr)return false; } blkaddr -=FDEV (devi).start_blk; + bdev =FDEV (devi).bdev; } -return bdev_zoned_model (FDEV (devi).bdev) ==BLK_ZONED_HM && +return bdev_is_zoned (bdev) &&f2fs_blkz_is_seq (sbi, devi, blkaddr) && (blkaddr % sbi->blocks_per_blkz == sbi->blocks_per_blkz -1 ); }
Signature · 1 line
2.34.1