linux/drivers/cxl/core
Kwangjin Ko f7c52345cc cxl/core: Fix initialization of mbox_cmd.size_out in get event
Since mbox_cmd.size_out is overwritten with the actual output size in
the function below, it needs to be initialized every time.

cxl_internal_send_cmd -> __cxl_pci_mbox_send_cmd

Problem scenario:

1) The size_out variable is initially set to the size of the mailbox.
2) Read an event.
   - size_out is set to 160 bytes(header 32B + one event 128B).
   - Two event are created while reading.
3) Read the new *two* events.
   - size_out is still set to 160 bytes.
   - Although the value of out_len is 288 bytes, only 160 bytes are
     copied from the mailbox register to the local variable.
   - record_count is set to 2.
   - Accessing records[1] will result in reading incorrect data.

Fixes: 6ebe28f9ec ("cxl/mem: Read, trace, and clear events on driver load")
Tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Kwangjin Ko <kwangjin.ko@sk.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2024-04-03 14:25:32 -07:00
..
cdat.c Merge branch 'for-6.9/cxl-fixes' into for-6.9/cxl 2024-03-13 00:17:18 -07:00
core.h cxl/region: Deal with numa nodes not enumerated by SRAT 2024-03-12 14:54:03 -07:00
hdm.c cxl/hdm: Fix dpa translation locking 2023-12-07 19:14:04 -08:00
Makefile cxl: Add callback to parse the DSMAS subtables from CDAT 2023-12-22 14:33:10 -08:00
mbox.c cxl/core: Fix initialization of mbox_cmd.size_out in get event 2024-04-03 14:25:32 -07:00
memdev.c cxl: Fix sysfs export of qos_class for memdev 2024-02-16 23:20:34 -08:00
pci.c lib/firmware_table: Provide buffer length argument to cdat_table_parse() 2024-03-13 00:03:21 -07:00
pmem.c cxl: Refactor to use __free() for cxl_root allocation in cxl_find_nvdimm_bridge() 2024-01-05 14:36:29 -08:00
pmu.c cxl/pmu: Ensure put_device on pmu devices 2023-12-14 21:54:45 -08:00
port.c Merge branch 'for-6.9/cxl-einj' into for-6.9/cxl 2024-03-13 00:09:20 -07:00
region.c cxl/region: Deal with numa nodes not enumerated by SRAT 2024-03-12 14:54:03 -07:00
regs.c cxl/core/regs: Fix usage of map->reg_type in cxl_decode_regblock() before assigned 2024-03-26 12:06:21 -07:00
suspend.c PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00
trace.c cxl/trace: Add an HPA to cxl_poison trace events 2023-04-23 11:46:13 -07:00
trace.h cxl/trace: Properly initialize cxl_poison region name 2024-03-18 10:26:03 -04:00