From: Jens Axboe <axboe@kernel.dk>
To: Edward Adam Davis <eadavis@qq.com>,
syzbot+09ddb593eea76a158f42@syzkaller.appspotmail.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH next] block: mempool alloc fail due to insufficient memory
Date: Sat, 21 Mar 2026 08:17:06 -0600 [thread overview]
Message-ID: <ca49c74d-7192-4189-8afb-96ea86054f50@kernel.dk> (raw)
In-Reply-To: <tencent_B483B24447B77B776C66D11362A37BE96505@qq.com>
On 3/21/26 2:36 AM, Edward Adam Davis wrote:
> Add a failure check for mempool_alloc() in the slowpath.
>
> [1]
> KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
> Workqueue: writeback wb_workfn (flush-8:0)
> RIP: 0010:bio_init block/bio.c:214 [inline]
> RIP: 0010:bio_init_inline include/linux/bio.h:435 [inline]
> RIP: 0010:bio_alloc_bioset+0x664/0xc10 block/bio.c:593
> Call Trace:
> bio_alloc include/linux/bio.h:373 [inline]
> submit_bh_wbc+0x22d/0x650 fs/buffer.c:2816
>
> Fixes: b520c4eef83d ("block: split bio_alloc_bioset more clearly into a fast and slowpath")
> Reported-by: syzbot+09ddb593eea76a158f42@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=09ddb593eea76a158f42
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> block/bio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/block/bio.c b/block/bio.c
> index 5057047194c4..0a870979bd41 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -582,6 +582,9 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
> opf &= ~REQ_ALLOC_CACHE;
>
> p = mempool_alloc(&bs->bio_pool, gfp);
> + if (unlikely(!p))
> + return NULL;
> +
Doesn't look right at all. You dropped the backtrace, which shows this is
off __block_write_full_folio() -> submit_bh_wbc() which allocates a bio
from the mempool with GFP_NOIO. That should allow blocking, and hence
mempool_alloc() should NEVER return NULL for that case. If it does,
it's broken, and your change is just papering around that issue.
--
Jens Axboe
next prev parent reply other threads:[~2026-03-21 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 22:44 [syzbot] [block?] general protection fault in bio_alloc_bioset syzbot
2026-03-21 8:36 ` [PATCH next] block: mempool alloc fail due to insufficient memory Edward Adam Davis
2026-03-21 14:17 ` Jens Axboe [this message]
2026-03-21 22:52 ` [syzbot] [block?] general protection fault in bio_alloc_bioset Vasily Gorbik
2026-03-22 0:18 ` syzbot
2026-03-22 2:23 ` Vasily Gorbik
2026-03-22 2:35 ` [PATCH] block: fix bio_alloc_bioset slowpath GFP handling Vasily Gorbik
2026-03-23 6:44 ` Christoph Hellwig
2026-03-23 13:58 ` Jens Axboe
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=ca49c74d-7192-4189-8afb-96ea86054f50@kernel.dk \
--to=axboe@kernel.dk \
--cc=eadavis@qq.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+09ddb593eea76a158f42@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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