Re: [PATCH v2 2/4] cxl/memdev: Hold memdev lock during memdev poison injection/clear

Li Ming
2026-03-19T11:11:00Z

在 2026/3/18 23:36, Dave Jiang 写道:
>
> On 3/18/26 4:59 AM, Li Ming wrote:
>> 在 2026/3/17 23:00, Dave Jiang 写道:
>>> On 3/14/26 12:06 AM, Li Ming wrote:
>>>> CXL memdev poison injection/clearing debugfs interfaces are visible
>>>> before the CXL memdev endpoint initialization, If user accesses the
>>>> interfaces before cxlmd->endpoint updated, it is possible to access an
>>>> invalid endpoint in cxl_dpa_to_region().
>>>>
>>>> Hold CXL memdev lock at the beginning of the interfaces, this blocks the
>>>> interfaces until CXL memdev probing completed.
>>>>
>>>> The following patch will check the given endpoint validity in
>>>> cxl_dpa_to_region().
>>>>
>>>> Suggested-by: Dan Williams <dan.j.williams@intel.com>
>>>> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>>>> Reviewed-by: Alison Schofield <alison.schofield@intel.com>
>>>> Signed-off-by: Li Ming <ming.li@zohomail.com>
>>> Hi Ming, I dropped this patch with Dan's comments [1] and updated cxl/next. Please check and make sure everything looks ok to you. Thanks!
>>>
>>> [1]: https://lore.kernel.org/linux-cxl/69b8b81621e16_452b100e@dwillia2-mobl4.notmuch/
>> Hi Dave,
>>
>> I think there is no change needed in this patch, just need a independent patch for holding memdev lock in cxl_region_debugfs_poison_inject/clear.
>>
>> Or you want to review this patch again?
> No. Maybe I misunderstood the comment from Dan. So we should keep this patch?
>
> DJ

Yes, I think so.

Ming