public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Yang Xiuwei <yangxiuwei@kylinos.cn>
Cc: axboe@kernel.dk, tom.leiming@gmail.com, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: fix page leak in bio_copy_kern when bio_add_page fails
Date: Tue, 3 Mar 2026 06:08:14 -0800	[thread overview]
Message-ID: <aabrTtw6WpPl3cvk@infradead.org> (raw)
In-Reply-To: <20260303072517.571437-1-yangxiuwei@kylinos.cn>

On Tue, Mar 03, 2026 at 03:25:17PM +0800, Yang Xiuwei wrote:
> When bio_add_page() fails in bio_copy_kern(), the allocated page
> is not freed before breaking the loop, leading to a memory leak.

bio_add_page can't fail here, as the bio is sized correctly using
blk_rq_map_bio_alloc.  So if you want to clean this up, please switch
to __bio_add_page instead of adding dead error handling code.


  parent reply	other threads:[~2026-03-03 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03  7:25 [PATCH] block: fix page leak in bio_copy_kern when bio_add_page fails Yang Xiuwei
2026-03-03  7:56 ` Ming Lei
2026-03-03 14:08 ` Christoph Hellwig [this message]
2026-03-04  1:26   ` Yang Xiuwei

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=aabrTtw6WpPl3cvk@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=tom.leiming@gmail.com \
    --cc=yangxiuwei@kylinos.cn \
    /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