From b87084572c02e4a186a2dde49eab8b088e4ad683 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 4 Jun 2020 12:13:07 +0200 Subject: [PATCH] 4.19-stable patches added patches: libnvdimm-fix-endian-conversion-issues.patch --- ...bnvdimm-fix-endian-conversion-issues.patch | 78 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 79 insertions(+) create mode 100644 queue-4.19/libnvdimm-fix-endian-conversion-issues.patch diff --git a/queue-4.19/libnvdimm-fix-endian-conversion-issues.patch b/queue-4.19/libnvdimm-fix-endian-conversion-issues.patch new file mode 100644 index 00000000000..a2f9f918b5f --- /dev/null +++ b/queue-4.19/libnvdimm-fix-endian-conversion-issues.patch @@ -0,0 +1,78 @@ +From 86aa66687442ef45909ff9814b82b4d2bb892294 Mon Sep 17 00:00:00 2001 +From: "Aneesh Kumar K.V" +Date: Fri, 9 Aug 2019 13:17:26 +0530 +Subject: libnvdimm: Fix endian conversion issues  +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Aneesh Kumar K.V + +commit 86aa66687442ef45909ff9814b82b4d2bb892294 upstream. + +nd_label->dpa issue was observed when trying to enable the namespace created +with little-endian kernel on a big-endian kernel. That made me run +`sparse` on the rest of the code and other changes are the result of that. + +Fixes: d9b83c756953 ("libnvdimm, btt: rework error clearing") +Fixes: 9dedc73a4658 ("libnvdimm/btt: Fix LBA masking during 'free list' population") +Reviewed-by: Vishal Verma +Signed-off-by: Aneesh Kumar K.V +Link: https://lore.kernel.org/r/20190809074726.27815-1-aneesh.kumar@linux.ibm.com +Signed-off-by: Dan Williams +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/nvdimm/btt.c | 8 ++++---- + drivers/nvdimm/namespace_devs.c | 7 ++++--- + 2 files changed, 8 insertions(+), 7 deletions(-) + +--- a/drivers/nvdimm/btt.c ++++ b/drivers/nvdimm/btt.c +@@ -400,9 +400,9 @@ static int btt_flog_write(struct arena_i + arena->freelist[lane].sub = 1 - arena->freelist[lane].sub; + if (++(arena->freelist[lane].seq) == 4) + arena->freelist[lane].seq = 1; +- if (ent_e_flag(ent->old_map)) ++ if (ent_e_flag(le32_to_cpu(ent->old_map))) + arena->freelist[lane].has_err = 1; +- arena->freelist[lane].block = le32_to_cpu(ent_lba(ent->old_map)); ++ arena->freelist[lane].block = ent_lba(le32_to_cpu(ent->old_map)); + + return ret; + } +@@ -568,8 +568,8 @@ static int btt_freelist_init(struct aren + * FIXME: if error clearing fails during init, we want to make + * the BTT read-only + */ +- if (ent_e_flag(log_new.old_map) && +- !ent_normal(log_new.old_map)) { ++ if (ent_e_flag(le32_to_cpu(log_new.old_map)) && ++ !ent_normal(le32_to_cpu(log_new.old_map))) { + arena->freelist[i].has_err = 1; + ret = arena_clear_freelist_error(arena, i); + if (ret) +--- a/drivers/nvdimm/namespace_devs.c ++++ b/drivers/nvdimm/namespace_devs.c +@@ -1996,7 +1996,7 @@ static struct device *create_namespace_p + nd_mapping = &nd_region->mapping[i]; + label_ent = list_first_entry_or_null(&nd_mapping->labels, + typeof(*label_ent), list); +- label0 = label_ent ? label_ent->label : 0; ++ label0 = label_ent ? label_ent->label : NULL; + + if (!label0) { + WARN_ON(1); +@@ -2332,8 +2332,9 @@ static struct device **scan_labels(struc + continue; + + /* skip labels that describe extents outside of the region */ +- if (nd_label->dpa < nd_mapping->start || nd_label->dpa > map_end) +- continue; ++ if (__le64_to_cpu(nd_label->dpa) < nd_mapping->start || ++ __le64_to_cpu(nd_label->dpa) > map_end) ++ continue; + + i = add_namespace_resource(nd_region, nd_label, devs, count); + if (i < 0) diff --git a/queue-4.19/series b/queue-4.19/series index e44d05ebbc8..28bf8ac4933 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -1 +1,2 @@ revert-cgroup-add-memory-barriers-to-plug-cgroup_rst.patch +libnvdimm-fix-endian-conversion-issues.patch -- 2.47.3