public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned
@ 2023-02-15 17:18 Martin K. Petersen
  2023-02-15 21:20 ` Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-02-15 17:18 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: Martin K. Petersen, Saurav Kashyap

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")
Reported-by: Saurav Kashyap <skashyap@marvell.com>
Tested-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 block/bio-integrity.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 3f5685c00e36..91ffee6fc8cb 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -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;
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned
  2023-02-15 17:18 [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Martin K. Petersen
@ 2023-02-15 21:20 ` Chaitanya Kulkarni
  2023-02-16  6:05 ` Christoph Hellwig
  2023-02-16 18:05 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2023-02-15 21:20 UTC (permalink / raw)
  To: Martin K. Petersen, axboe@kernel.dk, linux-block@vger.kernel.org
  Cc: Saurav Kashyap

On 2/15/23 09:18, Martin K. Petersen wrote:
> 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")
> Reported-by: Saurav Kashyap <skashyap@marvell.com>
> Tested-by: Saurav Kashyap <skashyap@marvell.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned
  2023-02-15 17:18 [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Martin K. Petersen
  2023-02-15 21:20 ` Chaitanya Kulkarni
@ 2023-02-16  6:05 ` Christoph Hellwig
  2023-02-16 18:05 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-02-16  6:05 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: axboe, linux-block, Saurav Kashyap

On Wed, Feb 15, 2023 at 12:18:01PM -0500, Martin K. Petersen wrote:
> 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:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned
  2023-02-15 17:18 [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Martin K. Petersen
  2023-02-15 21:20 ` Chaitanya Kulkarni
  2023-02-16  6:05 ` Christoph Hellwig
@ 2023-02-16 18:05 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2023-02-16 18:05 UTC (permalink / raw)
  To: linux-block, Martin K. Petersen; +Cc: Saurav Kashyap


On Wed, 15 Feb 2023 12:18:01 -0500, Martin K. Petersen wrote:
> 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,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-16 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 17:18 [PATCH] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Martin K. Petersen
2023-02-15 21:20 ` Chaitanya Kulkarni
2023-02-16  6:05 ` Christoph Hellwig
2023-02-16 18:05 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox