diff options
author | Michael Lyle <mlyle@lyle.org> | 2017-11-16 23:47:25 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-24 08:37:03 +0100 |
commit | 5d62da3a8e2aa3a056d6f7a9cc75a93a221f11b4 (patch) | |
tree | 17c5f732a567f9c92e105c4c64cd488800235366 /block | |
parent | 780a781dd6f1af9dfac15b8eeba1cb678c9fc380 (diff) | |
download | linux-stable-5d62da3a8e2aa3a056d6f7a9cc75a93a221f11b4.tar.gz linux-stable-5d62da3a8e2aa3a056d6f7a9cc75a93a221f11b4.tar.bz2 linux-stable-5d62da3a8e2aa3a056d6f7a9cc75a93a221f11b4.zip |
bio: ensure __bio_clone_fast copies bi_partno
commit 62530ed8b1d07a45dec94d46e521c0c6c2d476e6 upstream.
A new field was introduced in 74d46992e0d9, bi_partno, instead of using
bdev->bd_contains and encoding the partition information in the bi_bdev
field. __bio_clone_fast was changed to copy the disk information, but
not the partition information. At minimum, this regressed bcache and
caused data corruption.
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index")
Reported-by: Pavel Goran <via-bcache@pvgoran.name>
Reported-by: Campbell Steven <casteven@gmail.com>
Reviewed-by: Coly Li <colyli@suse.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/bio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c index 101c2a9b5481..33fa6b4af312 100644 --- a/block/bio.c +++ b/block/bio.c @@ -597,6 +597,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) * so we don't set nor calculate new physical/hw segment counts here */ bio->bi_disk = bio_src->bi_disk; + bio->bi_partno = bio_src->bi_partno; bio_set_flag(bio, BIO_CLONED); bio->bi_opf = bio_src->bi_opf; bio->bi_write_hint = bio_src->bi_write_hint; |