1
0
Fork 0
remarkable-linux/drivers/nvdimm
Vishal Verma c8d875b471 libnvdimm: fix ars_status output length calculation
commit 286e877181 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-09 19:56:01 +02:00
..
Kconfig pmem: add dax_operations support 2017-04-19 15:14:35 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
blk.c libnvdimm, {btt, blk}: do integrity setup before add_disk() 2018-03-28 18:24:41 +02:00
btt.c libnvdimm, {btt, blk}: do integrity setup before add_disk() 2018-03-28 18:24:41 +02:00
btt.h libnvdimm, btt: Fix an incompatibility in the log layout 2017-12-29 17:53:49 +01:00
btt_devs.c libnvdimm: rename nd_sector_size_{show,store} to nd_size_select_{show,store} 2017-08-11 17:36:54 -07:00
bus.c libnvdimm: fix ars_status output length calculation 2018-09-09 19:56:01 +02:00
claim.c libnvdimm, btt: rework error clearing 2017-08-31 15:05:10 -07:00
core.c libnvdimm: rename nd_sector_size_{show,store} to nd_size_select_{show,store} 2017-08-11 17:36:54 -07:00
dax_devs.c Merge branch 'for-4.13/dax' into libnvdimm-for-next 2017-07-03 16:54:58 -07:00
dimm.c libnvdimm, dimm: fix dpa reservation vs uninitialized label area 2018-04-24 09:36:32 +02:00
dimm_devs.c libnvdimm, dimm: clear 'locked' status on successful DIMM enable 2017-11-30 08:40:54 +00:00
e820.c libnvdimm, e820: use module_platform_driver 2016-12-05 08:52:21 -08:00
label.c libnvdimm, namespace: fix label initialization to use valid seq numbers 2017-11-30 08:40:54 +00:00
label.h libnvdimm, btt: BTT updates for UEFI 2.7 format 2017-06-29 13:50:38 -07:00
namespace_devs.c libnvdimm, namespace: use a safe lookup for dimm device name 2018-04-24 09:36:32 +02:00
nd-core.h libnvdimm, nfit: enable support for volatile ranges 2017-06-27 16:44:13 -07:00
nd.h libnvdimm, dimm: clear 'locked' status on successful DIMM enable 2017-11-30 08:40:54 +00:00
pfn.h libnvdimm, dax: autodetect support 2016-05-20 22:02:57 -07:00
pfn_devs.c libnvdimm, pfn: fix start_pad handling for aligned namespaces 2017-12-29 17:53:49 +01:00
pmem.c - Some request-based DM core and DM multipath fixes and cleanups 2017-09-14 13:43:16 -07:00
pmem.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
region.c libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime 2017-06-30 18:56:03 -07:00
region_devs.c libnvdimm, region : make 'resource' attribute only readable by root 2017-11-30 08:40:54 +00:00