Skip to content

Commit 9dca416

Browse files
Coly Liaxboe
authored andcommitted
bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook()
Commit abfc426 ("block: pass a block_device to bio_clone_fast") calls the modified bio_alloc_clone() in bcache code as: bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO); But the first parameter is wrong, where bio->bi_bdev should be orig_bio->bi_bdev. The wrong bi_bdev panics the kernel when submitting cache bio. This patch fixes the wrong bdev parameter usage and avoid the panic. Fixes: abfc426 ("block: pass a block_device to bio_clone_fast") Signed-off-by: Coly Li <colyli@suse.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Mike Snitzer <snitzer@redhat.com> Link: https://lore.kernel.org/r/20220419160425.4148-3-colyli@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ff2695e commit 9dca416

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/bcache/request.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ static void do_bio_hook(struct search *s,
685685
{
686686
struct bio *bio = &s->bio.bio;
687687

688-
bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO);
688+
bio_init_clone(orig_bio->bi_bdev, bio, orig_bio, GFP_NOIO);
689689
/*
690690
* bi_end_io can be set separately somewhere else, e.g. the
691691
* variants in,

0 commit comments

Comments
 (0)