]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 May 2021 08:54:52 +0000 (10:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 May 2021 08:54:52 +0000 (10:54 +0200)
added patches:
dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch
dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch

queue-4.4/dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch [new file with mode: 0644]
queue-4.4/dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch b/queue-4.4/dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch
new file mode 100644 (file)
index 0000000..9a20cbc
--- /dev/null
@@ -0,0 +1,76 @@
+From a88b2358f1da2c9f9fcc432f2e0a79617fea397c Mon Sep 17 00:00:00 2001
+From: Joe Thornber <ejt@redhat.com>
+Date: Mon, 29 Mar 2021 16:34:57 +0100
+Subject: dm persistent data: packed struct should have an aligned() attribute too
+
+From: Joe Thornber <ejt@redhat.com>
+
+commit a88b2358f1da2c9f9fcc432f2e0a79617fea397c upstream.
+
+Otherwise most non-x86 architectures (e.g. riscv, arm) will resort to
+byte-by-byte access.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Joe Thornber <ejt@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/persistent-data/dm-btree-internal.h   |    4 ++--
+ drivers/md/persistent-data/dm-space-map-common.h |    8 ++++----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/md/persistent-data/dm-btree-internal.h
++++ b/drivers/md/persistent-data/dm-btree-internal.h
+@@ -34,12 +34,12 @@ struct node_header {
+       __le32 max_entries;
+       __le32 value_size;
+       __le32 padding;
+-} __packed;
++} __attribute__((packed, aligned(8)));
+ struct btree_node {
+       struct node_header header;
+       __le64 keys[0];
+-} __packed;
++} __attribute__((packed, aligned(8)));
+ /*
+--- a/drivers/md/persistent-data/dm-space-map-common.h
++++ b/drivers/md/persistent-data/dm-space-map-common.h
+@@ -33,7 +33,7 @@ struct disk_index_entry {
+       __le64 blocknr;
+       __le32 nr_free;
+       __le32 none_free_before;
+-} __packed;
++} __attribute__ ((packed, aligned(8)));
+ #define MAX_METADATA_BITMAPS 255
+@@ -43,7 +43,7 @@ struct disk_metadata_index {
+       __le64 blocknr;
+       struct disk_index_entry index[MAX_METADATA_BITMAPS];
+-} __packed;
++} __attribute__ ((packed, aligned(8)));
+ struct ll_disk;
+@@ -86,7 +86,7 @@ struct disk_sm_root {
+       __le64 nr_allocated;
+       __le64 bitmap_root;
+       __le64 ref_count_root;
+-} __packed;
++} __attribute__ ((packed, aligned(8)));
+ #define ENTRIES_PER_BYTE 4
+@@ -94,7 +94,7 @@ struct disk_bitmap_header {
+       __le32 csum;
+       __le32 not_used;
+       __le64 blocknr;
+-} __packed;
++} __attribute__ ((packed, aligned(8)));
+ enum allocation_event {
+       SM_NONE,
diff --git a/queue-4.4/dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch b/queue-4.4/dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch
new file mode 100644 (file)
index 0000000..915e850
--- /dev/null
@@ -0,0 +1,33 @@
+From 5208692e80a1f3c8ce2063a22b675dd5589d1d80 Mon Sep 17 00:00:00 2001
+From: Joe Thornber <ejt@redhat.com>
+Date: Tue, 13 Apr 2021 09:11:53 +0100
+Subject: dm space map common: fix division bug in sm_ll_find_free_block()
+
+From: Joe Thornber <ejt@redhat.com>
+
+commit 5208692e80a1f3c8ce2063a22b675dd5589d1d80 upstream.
+
+This division bug meant the search for free metadata space could skip
+the final allocation bitmap's worth of entries. Fix affects DM thinp,
+cache and era targets.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Joe Thornber <ejt@redhat.com>
+Tested-by: Ming-Hung Tsai <mtsai@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/persistent-data/dm-space-map-common.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/md/persistent-data/dm-space-map-common.c
++++ b/drivers/md/persistent-data/dm-space-map-common.c
+@@ -337,6 +337,8 @@ int sm_ll_find_free_block(struct ll_disk
+        */
+       begin = do_div(index_begin, ll->entries_per_block);
+       end = do_div(end, ll->entries_per_block);
++      if (end == 0)
++              end = ll->entries_per_block;
+       for (i = index_begin; i < index_end; i++, begin = 0) {
+               struct dm_block *blk;
index 41e06e7616e4223e1dace5dee5ace76512ecdc67..28990cd1f45018c40401e450e41fb038e31a0a0f 100644 (file)
@@ -49,3 +49,5 @@ ext4-fix-check-to-prevent-false-positive-report-of-incorrect-used-inodes.patch
 ext4-fix-error-code-in-ext4_commit_super.patch
 usb-gadget-dummy_hcd-fix-gpf-in-gadget_setup.patch
 usb-gadget-function-f_fs-string-table-fix-for-multiple-languages.patch
+dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch
+dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch