Skip to content

Commit 261a02b

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl/core: Check existence of cxl_memdev_state in poison test
Before now, all CXL memdevs were assumed to have a mailbox-backed cxl_memdev_state, so poison command checks could safely dereference the @mds. With the introduction of Type 2 devices, a memdev may not implement a mailbox interface, and so there is no associated cxl_memdev_state. Guard against this case by returning false when @mds is absent. Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Alejandro Lucero <alucerop@amd.com> Link: https://patch.msgid.link/20260331005047.2813980-1-alison.schofield@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 7974835 commit 261a02b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/cxl/core/memdev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ bool cxl_memdev_has_poison_cmd(struct cxl_memdev *cxlmd,
204204
{
205205
struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds);
206206

207+
if (!mds)
208+
return 0;
209+
207210
return test_bit(cmd, mds->poison.enabled_cmds);
208211
}
209212

0 commit comments

Comments
 (0)