mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
cxl/security: Fix Get Security State output payload endian handling
Multi-byte integer values in CXL mailbox payloads are little endian. Add
a definition of the Get Security State output payload and convert the
value before testing flags.
Fixes: 3282811555
("cxl/pmem: Introduce nvdimm_security_ops with ->get_flags() operation")
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/167030054822.4044561.4917796262037689553.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
c99b2e8cf7
commit
f5ee4cc19c
1 changed files with 5 additions and 1 deletions
|
@ -16,14 +16,18 @@ static unsigned long cxl_pmem_get_security_flags(struct nvdimm *nvdimm,
|
||||||
struct cxl_memdev *cxlmd = cxl_nvd->cxlmd;
|
struct cxl_memdev *cxlmd = cxl_nvd->cxlmd;
|
||||||
struct cxl_dev_state *cxlds = cxlmd->cxlds;
|
struct cxl_dev_state *cxlds = cxlmd->cxlds;
|
||||||
unsigned long security_flags = 0;
|
unsigned long security_flags = 0;
|
||||||
|
struct cxl_get_security_output {
|
||||||
|
__le32 flags;
|
||||||
|
} out;
|
||||||
u32 sec_out;
|
u32 sec_out;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_SECURITY_STATE, NULL, 0,
|
rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_SECURITY_STATE, NULL, 0,
|
||||||
&sec_out, sizeof(sec_out));
|
&out, sizeof(out));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
sec_out = le32_to_cpu(out.flags);
|
||||||
if (ptype == NVDIMM_MASTER) {
|
if (ptype == NVDIMM_MASTER) {
|
||||||
if (sec_out & CXL_PMEM_SEC_STATE_MASTER_PASS_SET)
|
if (sec_out & CXL_PMEM_SEC_STATE_MASTER_PASS_SET)
|
||||||
set_bit(NVDIMM_SECURITY_UNLOCKED, &security_flags);
|
set_bit(NVDIMM_SECURITY_UNLOCKED, &security_flags);
|
||||||
|
|
Loading…
Add table
Reference in a new issue