Skip to contentSkip to conversation

Patch "bio: ensure __bio_clone_fast copies bi_partno" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Nov 21, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

bio: ensure __bio_clone_fast copies bi_partno

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
bio-ensure-__bio_clone_fast-copies-bi_partno.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 62530ed8b1d07a45dec94d46e521c0c6c2d476e6 Mon Sep 17 00:00:00 2001

From: Michael Lyle <[email protected]>
Date: Thu, 16 Nov 2017 23:47:25 -0800
Subject: bio: ensure __bio_clone_fast copies bi_partno

From: Michael Lyle <[email protected]>

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.

Fixes 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index")
---
 block/bio.c |    1 +
 1 file changed, 1 insertion(+)
block/bio.c +1 -0
@@ -597,6 +597,7 @@ void __bio_clone_fast(struct bio *bio, s
 	 * 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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/bio-ensure-__bio_clone_fast-copies-bi_partno.patch