]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm-integrity: limit MAX_TAG_SIZE to 255
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 8 Sep 2025 13:52:02 +0000 (15:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Oct 2025 11:01:01 +0000 (13:01 +0200)
[ Upstream commit 77b8e6fbf9848d651f5cb7508f18ad0971f3ffdb ]

MAX_TAG_SIZE was 0x1a8 and it may be truncated in the "bi->metadata_size
= ic->tag_size" assignment. We need to limit it to 255.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-integrity.c

index 4395657fa5838efbc96d98f7420986b0544d9847..7b1d8f0c62fdabf79d7cfe7acd2b5303261a03f9 100644 (file)
@@ -133,7 +133,7 @@ struct journal_sector {
        commit_id_t commit_id;
 };
 
-#define MAX_TAG_SIZE                   (JOURNAL_SECTOR_DATA - JOURNAL_MAC_PER_SECTOR - offsetof(struct journal_entry, last_bytes[MAX_SECTORS_PER_BLOCK]))
+#define MAX_TAG_SIZE                   255
 
 #define METADATA_PADDING_SECTORS       8