From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org
Cc: stable@kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs: fix to check bio after __blkdev_issue_discard()
Date: Wed, 26 Nov 2025 14:14:37 +0800 [thread overview]
Message-ID: <20251126061437.658896-1-chao@kernel.org> (raw)
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@kernel.org
Fixes: e8b4869bc78d ("block: add a blk_alloc_discard_bio helper")
Signed-off-by: Chao Yu <chao@kernel.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
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>,
stable@kernel.org
Subject: [PATCH] f2fs: fix to check bio after __blkdev_issue_discard()
Date: Wed, 26 Nov 2025 14:14:37 +0800 [thread overview]
Message-ID: <20251126061437.658896-1-chao@kernel.org> (raw)
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@kernel.org
Fixes: e8b4869bc78d ("block: add a blk_alloc_discard_bio helper")
Signed-off-by: Chao Yu <chao@kernel.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
next reply other threads:[~2025-11-26 6:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 6:14 Chao Yu via Linux-f2fs-devel [this message]
2025-11-26 6:14 ` [PATCH] f2fs: fix to check bio after __blkdev_issue_discard() Chao Yu
2025-11-26 6:41 ` [f2fs-dev] " Christoph Hellwig
2025-11-26 6:41 ` Christoph Hellwig
2025-11-28 3:34 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-11-28 3:34 ` 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=20251126061437.658896-1-chao@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.