]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jun 2020 10:14:42 +0000 (12:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jun 2020 10:14:42 +0000 (12:14 +0200)
added patches:
libnvdimm-fix-endian-conversion-issues.patch
scsi-scsi_devinfo-fixup-string-compare.patch

queue-4.14/libnvdimm-fix-endian-conversion-issues.patch [new file with mode: 0644]
queue-4.14/scsi-scsi_devinfo-fixup-string-compare.patch [new file with mode: 0644]
queue-4.14/series [new file with mode: 0644]

diff --git a/queue-4.14/libnvdimm-fix-endian-conversion-issues.patch b/queue-4.14/libnvdimm-fix-endian-conversion-issues.patch
new file mode 100644 (file)
index 0000000..8038abf
--- /dev/null
@@ -0,0 +1,78 @@
+From 86aa66687442ef45909ff9814b82b4d2bb892294 Mon Sep 17 00:00:00 2001
+From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
+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 <aneesh.kumar@linux.ibm.com>
+
+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 <vishal.l.verma@intel.com>
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Link: https://lore.kernel.org/r/20190809074726.27815-1-aneesh.kumar@linux.ibm.com
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
+@@ -399,9 +399,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;
+ }
+@@ -567,8 +567,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
+@@ -1978,7 +1978,7 @@ struct device *create_namespace_pmem(str
+               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);
+@@ -2315,8 +2315,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.14/scsi-scsi_devinfo-fixup-string-compare.patch b/queue-4.14/scsi-scsi_devinfo-fixup-string-compare.patch
new file mode 100644 (file)
index 0000000..dd6e61d
--- /dev/null
@@ -0,0 +1,83 @@
+From b8018b973c7cefa5eb386540130fa47315b8e337 Mon Sep 17 00:00:00 2001
+From: Hannes Reinecke <hare@suse.de>
+Date: Mon, 2 Oct 2017 16:26:37 +0200
+Subject: scsi: scsi_devinfo: fixup string compare
+
+From: Hannes Reinecke <hare@suse.de>
+
+commit b8018b973c7cefa5eb386540130fa47315b8e337 upstream.
+
+When checking the model and vendor string we need to use the minimum
+value of either string, otherwise we'll miss out on wildcard matches.
+
+And we should take care when matching with zero size strings; results
+might be unpredictable.  With this patch the rules for matching devinfo
+strings are as follows:
+
+- Vendor strings must match exactly
+- Empty Model strings will only match if the devinfo model
+  is also empty
+- Model strings shorter than the devinfo model string will
+  not match
+
+Fixes: 5e7ff2c ("SCSI: fix new bug in scsi_dev_info_list string matching")
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/scsi_devinfo.c |   23 +++++++++++++----------
+ 1 file changed, 13 insertions(+), 10 deletions(-)
+
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -392,8 +392,8 @@ EXPORT_SYMBOL(scsi_dev_info_list_add_key
+ /**
+  * scsi_dev_info_list_find - find a matching dev_info list entry.
+- * @vendor:   vendor string
+- * @model:    model (product) string
++ * @vendor:   full vendor string
++ * @model:    full model (product) string
+  * @key:      specify list to use
+  *
+  * Description:
+@@ -408,7 +408,7 @@ static struct scsi_dev_info_list *scsi_d
+       struct scsi_dev_info_list *devinfo;
+       struct scsi_dev_info_list_table *devinfo_table =
+               scsi_devinfo_lookup_by_key(key);
+-      size_t vmax, mmax;
++      size_t vmax, mmax, mlen;
+       const char *vskip, *mskip;
+       if (IS_ERR(devinfo_table))
+@@ -447,15 +447,18 @@ static struct scsi_dev_info_list *scsi_d
+                           dev_info_list) {
+               if (devinfo->compatible) {
+                       /*
+-                       * Behave like the older version of get_device_flags.
++                       * vendor strings must be an exact match
+                        */
+-                      if (memcmp(devinfo->vendor, vskip, vmax) ||
+-                                      (vmax < sizeof(devinfo->vendor) &&
+-                                              devinfo->vendor[vmax]))
++                      if (vmax != strlen(devinfo->vendor) ||
++                          memcmp(devinfo->vendor, vskip, vmax))
+                               continue;
+-                      if (memcmp(devinfo->model, mskip, mmax) ||
+-                                      (mmax < sizeof(devinfo->model) &&
+-                                              devinfo->model[mmax]))
++
++                      /*
++                       * @model specifies the full string, and
++                       * must be larger or equal to devinfo->model
++                       */
++                      mlen = strlen(devinfo->model);
++                      if (mmax < mlen || memcmp(devinfo->model, mskip, mlen))
+                               continue;
+                       return devinfo;
+               } else {
diff --git a/queue-4.14/series b/queue-4.14/series
new file mode 100644 (file)
index 0000000..fc24b31
--- /dev/null
@@ -0,0 +1,2 @@
+scsi-scsi_devinfo-fixup-string-compare.patch
+libnvdimm-fix-endian-conversion-issues.patch