On Mon, Jan 12, 2026 at 12:23:45PM -0500, Sasha Levin wrote:
This is a note to let you know that I've just added the patch titled
bcache: fix improper use of bi_end_ioto the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: bcache-fix-improper-use-of-bi_end_io.patch and it can be found in the queue-6.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
Has this code been tested?
bio_endio() is not equivalent to calling bi_end_io; if the code is swapping out bi_end_io to pass it down the stack, then you have two completions on the same bio - you cannot call bio_endio() twice on the same bio.
commit 81e7e43a810e8f40e163928d441de02d2816b073 Author: Shida Zhang zhangshida@kylinos.cn Date: Tue Dec 9 17:01:56 2025 +0800
bcache: fix improper use of bi_end_io[ Upstream commit 53280e398471f0bddbb17b798a63d41264651325 ] Don't call bio->bi_end_io() directly. Use the bio_endio() helper function instead, which handles completion more safely and uniformly. Suggested-by: Christoph Hellwig hch@infradead.org Reviewed-by: Christoph Hellwig hch@lst.de Signed-off-by: Shida Zhang zhangshida@kylinos.cn Signed-off-by: Jens Axboe axboe@kernel.dk Signed-off-by: Sasha Levin sashal@kernel.org
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index a9b1f3896249b..b4059d2daa326 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1090,7 +1090,7 @@ static void detached_dev_end_io(struct bio *bio) } kfree(ddip);
- bio->bi_end_io(bio);
- bio_endio(bio);
} static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, @@ -1107,7 +1107,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); if (!ddip) { bio->bi_status = BLK_STS_RESOURCE;
bio->bi_end_io(bio);
return; }bio_endio(bio);@@ -1122,7 +1122,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, if ((bio_op(bio) == REQ_OP_DISCARD) && !bdev_max_discard_sectors(dc->bdev))
bio->bi_end_io(bio);
else submit_bio_noacct(bio);detached_dev_end_io(bio);}