kernel-ark/drivers/nvdimm
Vishal Verma 286e877181 libnvdimm: fix ars_status output length calculation
Commit efda1b5d87 ("acpi, nfit, libnvdimm: fix / harden ars_status output length handling")
Introduced additional hardening for ambiguity in the ACPI spec for
ars_status output sizing. However, it had a couple of cases mixed up.
Where it should have been checking for (and returning) "out_field[1] -
4" it was using "out_field[1] - 8" and vice versa.

This caused a four byte discrepancy in the buffer size passed on to
the command handler, and in some cases, this caused memory corruption
like:

  ./daxdev-errors.sh: line 76: 24104 Aborted   (core dumped) ./daxdev-errors $busdev $region
  malloc(): memory corruption
  Program received signal SIGABRT, Aborted.
  [...]
  #5  0x00007ffff7865a2e in calloc () from /lib64/libc.so.6
  #6  0x00007ffff7bc2970 in ndctl_bus_cmd_new_ars_status (ars_cap=ars_cap@entry=0x6153b0) at ars.c:136
  #7  0x0000000000401644 in check_ars_status (check=0x7fffffffdeb0, bus=0x604c20) at daxdev-errors.c:144
  #8  test_daxdev_clear_error (region_name=<optimized out>, bus_name=<optimized out>)
      at daxdev-errors.c:332

Cc: <stable@vger.kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Lukasz Dorau <lukasz.dorau@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Fixes: efda1b5d87 ("acpi, nfit, libnvdimm: fix / harden ars_status output length handling")
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-of-by: Dave Jiang <dave.jiang@intel.com>
2018-08-20 08:56:38 -07:00
..
badrange.c libnvdimm, badrange: remove a WARN for list_empty 2017-11-02 10:42:30 -07:00
blk.c for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
btt_devs.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
btt.c for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
btt.h libnvdimm, btt: Fix an incompatibility in the log layout 2017-12-21 14:59:27 -08:00
bus.c libnvdimm: fix ars_status output length calculation 2018-08-20 08:56:38 -07:00
claim.c libnvdimm, pmem: Fix memcpy_mcsafe() return code handling in nsio_rw_bytes() 2018-06-28 18:21:30 -07:00
core.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
dax_devs.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
dimm_devs.c libnvdimm: Use max contiguous area for namespace size 2018-07-25 14:11:09 -07:00
dimm.c libnvdimm: Introduce locked DIMM capacity support 2018-07-14 10:27:00 -07:00
e820.c libnvdimm, e820: Register all pmem resources 2018-06-02 17:05:43 -07:00
Kconfig Revert "libnvdimm, of_pmem: workaround OF_NUMA=n build error" 2018-04-19 15:10:56 -07:00
label.c libnvdimm, label: change nvdimm_num_label_slots per UEFI 2.7 2018-03-15 13:59:57 -07:00
label.h libnvdimm, label: change min label storage size per UEFI 2.7 2018-03-15 10:44:32 -07:00
Makefile libnvdimm: Add device-tree based driver 2018-04-07 07:53:23 -07:00
namespace_devs.c libnvdimm: Use max contiguous area for namespace size 2018-07-25 14:11:09 -07:00
nd-core.h libnvdimm: Use max contiguous area for namespace size 2018-07-25 14:11:09 -07:00
nd.h libnvdimm: Introduce locked DIMM capacity support 2018-07-14 10:27:00 -07:00
of_pmem.c libnvdimm, of_pmem: use dev_to_node() instead of of_node_to_nid() 2018-04-19 15:07:10 -07:00
pfn_devs.c mm: introduce MEMORY_DEVICE_FS_DAX and CONFIG_DEV_PAGEMAP_OPS 2018-05-22 06:59:39 -07:00
pfn.h libnvdimm, dax: autodetect support 2016-05-20 22:02:57 -07:00
pmem.c libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access() 2018-07-30 09:32:38 -07:00
pmem.h memremap: change devm_memremap_pages interface to use struct dev_pagemap 2018-01-08 11:46:23 -08:00
region_devs.c libnvdimm: Export max available extent 2018-07-25 14:11:43 -07:00
region.c libnvdimm, region: quiet region probe 2018-04-07 07:47:10 -07:00