mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
cxl/memdev: Hold memdev lock during memdev poison injection/clear
cxl_dpa_to_region() assumes that it is running a context where it is not racing changes to "cxlmd->dev.driver". Acquire the memdev device lock in the debugfs entry points to preclude debugfs usage racing cxl_mem driver detach. Suggested-by: Dan Williams <djbw@kernel.org> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dan Williams <djbw@kernel.org> Signed-off-by: Li Ming <ming.li@zohomail.com> Link: https://patch.msgid.link/20260423111949.177399-1-ming.li@zohomail.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
e43ffb69e0
commit
574eda81d0
|
|
@ -48,6 +48,11 @@ static int cxl_mem_dpa_show(struct seq_file *file, void *data)
|
|||
static int cxl_debugfs_poison_inject(void *data, u64 dpa)
|
||||
{
|
||||
struct cxl_memdev *cxlmd = data;
|
||||
int rc;
|
||||
|
||||
ACQUIRE(device_intr, devlock)(&cxlmd->dev);
|
||||
if ((rc = ACQUIRE_ERR(device_intr, &devlock)))
|
||||
return rc;
|
||||
|
||||
return cxl_inject_poison(cxlmd, dpa);
|
||||
}
|
||||
|
|
@ -58,6 +63,11 @@ DEFINE_DEBUGFS_ATTRIBUTE(cxl_poison_inject_fops, NULL,
|
|||
static int cxl_debugfs_poison_clear(void *data, u64 dpa)
|
||||
{
|
||||
struct cxl_memdev *cxlmd = data;
|
||||
int rc;
|
||||
|
||||
ACQUIRE(device_intr, devlock)(&cxlmd->dev);
|
||||
if ((rc = ACQUIRE_ERR(device_intr, &devlock)))
|
||||
return rc;
|
||||
|
||||
return cxl_clear_poison(cxlmd, dpa);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user