From: Daejun Park <daejun7.park@samsung.com>
To: "jaegeuk@kernel.org" <jaegeuk@kernel.org>,
"chao@kernel.org" <chao@kernel.org>,
"daehojeong@google.com" <daehojeong@google.com>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Daejun Park <daejun7.park@samsung.com>,
Seokhwan Kim <sukka.kim@samsung.com>,
Dongjin Kim <dongjin_.kim@samsung.com>,
Yonggil Song <yonggil.song@samsung.com>,
Jaeyoon Choi <j_yoon.choi@samsung.com>,
Nayeon Kim <nayeoni.kim@samsung.com>,
Siwoo Jung <siu.jung@samsung.com>
Subject: [PATCH] f2fs: fix null reference error when checking end of zone
Date: Thu, 04 Jul 2024 10:01:21 +0900 [thread overview]
Message-ID: <20240704010121epcms2p4cff8b25d976d4a1b820ba18f1eb5aa90@epcms2p4> (raw)
In-Reply-To: <CGME20240704010121epcms2p4cff8b25d976d4a1b820ba18f1eb5aa90@epcms2p4>
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 <daejun7.park@samsung.com>
---
fs/f2fs/data.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index b6dcb3bcaef7..1aa7eefa659c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -925,6 +925,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)) {
@@ -935,8 +936,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_is_zoned(FDEV(devi).bdev) &&
+ return bdev_is_zoned(bdev) &&
f2fs_blkz_is_seq(sbi, devi, blkaddr) &&
(blkaddr % sbi->blocks_per_blkz == sbi->blocks_per_blkz - 1);
}
--
2.25.1
next parent reply other threads:[~2024-07-04 1:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240704010121epcms2p4cff8b25d976d4a1b820ba18f1eb5aa90@epcms2p4>
2024-07-04 1:01 ` Daejun Park [this message]
2024-07-04 6:26 ` Markus Elfring
2024-07-04 7:15 ` Chao Yu
2024-07-09 22:20 ` [f2fs-dev] " Daeho Jeong
2024-07-15 14:40 ` patchwork-bot+f2fs
2024-07-04 7:55 ` Daejun Park
2024-07-04 9:32 ` (2) " Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240704010121epcms2p4cff8b25d976d4a1b820ba18f1eb5aa90@epcms2p4 \
--to=daejun7.park@samsung.com \
--cc=chao@kernel.org \
--cc=daehojeong@google.com \
--cc=dongjin_.kim@samsung.com \
--cc=j_yoon.choi@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nayeoni.kim@samsung.com \
--cc=siu.jung@samsung.com \
--cc=sukka.kim@samsung.com \
--cc=yonggil.song@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®