[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251126061437.658896-1-chao@kernel.org>
Date: Wed, 26 Nov 2025 14:14:37 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Chao Yu <chao@...nel.org>,
stable@...nel.org
Subject: [PATCH] f2fs: fix to check bio after __blkdev_issue_discard()
Previously, __blkdev_issue_discard() will always returned valid bio,
after commit e8b4869bc78d ("block: add a blk_alloc_discard_bio helper"),
it can return bio w/ NULL value, which may trigger panic or warning
in __submit_discard_cmd(), let's fix to check bio instread of return
value after __blkdev_issue_discard().
Cc: stable@...nel.org
Fixes: e8b4869bc78d ("block: add a blk_alloc_discard_bio helper")
Signed-off-by: Chao Yu <chao@...nel.org>
---
fs/f2fs/segment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8375dca7ed9e..44c0cefbb5a9 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1351,7 +1351,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
SECTOR_FROM_BLOCK(len),
GFP_NOFS, &bio);
}
- if (err) {
+ if (err || bio == NULL) {
spin_lock_irqsave(&dc->lock, flags);
if (dc->state == D_PARTIAL)
dc->state = D_SUBMIT;
--
2.49.0
Powered by blists - more mailing lists