Skip to contentSkip to conversation

block: bio-integrity: Copy flags when bio_integrity_payload is cloned

PATCH Applied Martin K. Petersen 4 participants 4 messages Feb 15, 2023 – Feb 16, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: bio-integrity: Copy flags when bio_integrity_payload is cloned

Make sure to copy the flags when a bio_integrity_payload is cloned. Otherwise per-I/O properties such as IP checksum flag will not be passed down to the HBA driver. Since the integrity buffer is owned by the original bio, the BIP_BLOCK_INTEGRITY flag needs to be masked off to avoid a double free in the completion path.

Fixes aae7df50190a ("block: Integrity checksum flag")
Fixes b1f01388574c ("block: Relocate bio integrity flags")
---
 block/bio-integrity.c | 1 +
 1 file changed, 1 insertion(+)
block/bio-integrity.c +1 -0
index 3f5685c00e36..91ffee6fc8cb 100644
@@ -418,6 +418,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
 
 	bip->bip_vcnt = bip_src->bip_vcnt;
 	bip->bip_iter = bip_src->bip_iter;
+	bip->bip_flags = bip_src->bip_flags & ~BIP_BLOCK_INTEGRITY;
 
 	return 0;
 }
Signature · 1 line
2.36.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Martin K. Petersen

Make sure to copy the flags when a bio_integrity_payload is cloned. Otherwise per-I/O properties such as IP checksum flag will not be passed down to the HBA driver. Since the integrity buffer is owned by the original bio, the BIP_BLOCK_INTEGRITY flag needs to be masked off to avoid a double free in the completion path.

Quoted 6 lines
Fixes aae7df50190a ("block: Integrity checksum flag")
Fixes b1f01388574c ("block: Relocate bio integrity flags")

---

Looks good.

-ck

Reviewed-by on v1 1/1
#2 lore raw
In reply to Martin K. Petersen
Quoted 5 lines · Martin K. Petersen

Make sure to copy the flags when a bio_integrity_payload is cloned. Otherwise per-I/O properties such as IP checksum flag will not be passed down to the HBA driver. Since the integrity buffer is owned by the original bio, the BIP_BLOCK_INTEGRITY flag needs to be masked off to avoid a double free in the completion path.

Looks good:

maintainer Applied
#3 lore raw
In reply to Martin K. Petersen
Quoted 8 lines · Martin K. Petersen

Make sure to copy the flags when a bio_integrity_payload is cloned. Otherwise per-I/O properties such as IP checksum flag will not be passed down to the HBA driver. Since the integrity buffer is owned by the original bio, the BIP_BLOCK_INTEGRITY flag needs to be masked off to avoid a double free in the completion path.

[...]

Applied, thanks!

[1/1] block: bio-integrity: Copy flags when bio_integrity_payload is cloned

      commit: b6a4bdcda430e3ca43bbb9cb1d4d4d34ebe15c40

Best regards,

Signature · 1 line
Jens Axboe