]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme: set pi_offset only when checksum type is not BLK_INTEGRITY_CSUM_NONE
authorAnuj Gupta <anuj20.g@samsung.com>
Mon, 30 Jun 2025 09:05:47 +0000 (14:35 +0530)
committerChristian Brauner <brauner@kernel.org>
Tue, 1 Jul 2025 12:00:15 +0000 (14:00 +0200)
protection information is treated as opaque when checksum type is
BLK_INTEGRITY_CSUM_NONE. In order to maintain the right metadata
semantics, set pi_offset only in cases where checksum type is not
BLK_INTEGRITY_CSUM_NONE.

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://lore.kernel.org/20250630090548.3317-4-anuj20.g@samsung.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
drivers/nvme/host/core.c

index fe72accab5160079e3b5a0b2c7368e1437b2a149..806b6e73276d4b57584b3e611e32b7ee181d67a7 100644 (file)
@@ -1867,9 +1867,10 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
        }
 
        bi->metadata_size = head->ms;
-       if (bi->csum_type)
+       if (bi->csum_type) {
                bi->pi_tuple_size = head->pi_size;
-       bi->pi_offset = info->pi_offset;
+               bi->pi_offset = info->pi_offset;
+       }
        return true;
 }