summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2019-01-14 14:07:19 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-31 08:13:45 +0100
commit8d93b82587a9463130f641d879e4fb5e636720d5 (patch)
tree89ecc1dbe5751c2c2fcf55319be3946d44570f75
parent28edadd147bfed92e3e16ed519ef098276935d94 (diff)
downloadlinux-exynos-8d93b82587a9463130f641d879e4fb5e636720d5.tar.gz
linux-exynos-8d93b82587a9463130f641d879e4fb5e636720d5.tar.bz2
linux-exynos-8d93b82587a9463130f641d879e4fb5e636720d5.zip
acpi/nfit: Block function zero DSMs
commit 5e9e38d0db1d29efed1dd4cf9a70115d33521be7 upstream. In preparation for using function number 0 as an error value, prevent it from being considered a valid function value by acpi_nfit_ctl(). Cc: <stable@vger.kernel.org> Cc: stuart hayes <stuart.w.hayes@gmail.com> Fixes: e02fb7264d8a ("nfit: add Microsoft NVDIMM DSM command set...") Reported-by: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/acpi/nfit/core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 8260b90eb64b..abd1a4e8b5a6 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1503,6 +1503,13 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
return 0;
}
+ /*
+ * Function 0 is the command interrogation function, don't
+ * export it to potential userspace use, and enable it to be
+ * used as an error value in acpi_nfit_ctl().
+ */
+ dsm_mask &= ~1UL;
+
guid = to_nfit_uuid(nfit_mem->family);
for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
if (acpi_check_dsm(adev_dimm->handle, guid, 1, 1ULL << i))