diff options
author | Dan Williams <dan.j.williams@intel.com> | 2019-01-30 09:06:41 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2019-01-30 09:08:34 +0300 |
commit | f596c8844fe1d0022007ae6c7a377361fb653eff (patch) | |
tree | 6e702de90e66c6f2f4d0727676dbe3d046d22966 /lib | |
parent | 966d23a006ca7b44ac8cf4d0c96b19785e0c3da0 (diff) | |
download | linux-f596c8844fe1d0022007ae6c7a377361fb653eff.tar.xz |
nfit: Fix nfit_intel_shutdown_status() command submission
The implementation is broken in all the ways the unit test did not touch:
1/ The local definition of in_buf and in_obj violated C99 initializer
expectations for zeroing. By only initializing 2 out of the three
struct members the compiler was free to zero-initialize the remaining
entry even though the aliased location in the union was initialized.
2/ The implementation made assumptions about the state of the 'smart'
payload after command execution that are satisfied by
acpi_nfit_ctl(), but not acpi_evaluate_dsm().
3/ populate_shutdown_status() is skipped on Intel NVDIMMs due to the early
return for skipping the common _LS{I,R,W} enabling.
4/ The input length should be zero.
This breakage was missed due to the unit test implementation only
testing the case where nfit_intel_shutdown_status() returns a valid
payload.
Much of this complexity would be saved if acpi_nfit_ctl() could be used, but
that currently requires a 'struct nvdimm *' argument and one is not created
until later in the init process. The health result is needed before the device
is created because the payload gates whether the nmemX/nfit/dirty_shutdown
property is visible in sysfs.
Cc: <stable@vger.kernel.org>
Fixes: 0ead11181fe0 ("acpi, nfit: Collect shutdown status")
Reported-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions