From: Michael Lyle Date: Fri, 17 Nov 2017 07:47:25 +0000 (-0800) Subject: bio: ensure __bio_clone_fast copies bi_partno X-Git-Tag: v4.14.2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d62da3a8e2aa3a056d6f7a9cc75a93a221f11b4;p=platform%2Fkernel%2Flinux-exynos.git 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 Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index") Reported-by: Pavel Goran Reported-by: Campbell Steven Reviewed-by: Coly Li Reviewed-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/block/bio.c b/block/bio.c index 101c2a9..33fa6b4 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;