From: Dan Williams Date: Mon, 14 Jan 2019 22:07:19 +0000 (-0800) Subject: acpi/nfit: Block function zero DSMs X-Git-Tag: v4.19.19~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cb00cfa3d37e46b3c8ee4af97fb52d29b07fbc0;p=platform%2Fkernel%2Flinux-rpi.git 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: Cc: stuart hayes Fixes: e02fb7264d8a ("nfit: add Microsoft NVDIMM DSM command set...") Reported-by: Jeff Moyer Reviewed-by: Jeff Moyer Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 75b331f..1697fbc 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1764,6 +1764,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,