Re: [PATCH v3] cxl/memdev: fix deadlock in cxl_memdev_autoremove() on attach failure

From: Gregory Price

Date: Fri Feb 13 2026 - 00:20:02 EST


On Thu, Feb 12, 2026 at 07:16:41PM -0800, dan.j.williams@xxxxxxxxx wrote:
> Gregory Price wrote:
> > cxl_memdev_autoremove() takes device_lock(&cxlmd->dev) via guard(device)
> > and then calls cxl_memdev_unregister() when the attach callback was
> > provided but cxl_mem_probe() failed to bind.
> >
> > cxl_memdev_unregister() calls
> > cdev_device_del()
> > device_del()
> > bus_remove_device()
> > device_release_driver()
> >
> > This path is reached when a driver uses the @attach parameter to
> > devm_cxl_add_memdev() and the CXL topology fails to enumerate (e.g.
> > DVSEC range registers decode outside platform-defined CXL ranges,
> > causing the endpoint port probe to fail).
> >
> > Add cxl_memdev_attach_failed() to set the scope of the check correctly.
> >
> > Fixes: 29317f8dc6ed ("cxl/mem: Introduce cxl_memdev_attach for CXL-dependent operation")
> > Signed-off-by: Gregory Price <gourry@xxxxxxxxxx>
>
> Looks good,
>
> Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>
>
> This was a kreview find? Would it make sense to do something like
> "Reported-by: kreview-<git sha>"?

Technically it's a combination of Claude using kreview, but I think this
is reasonable since Claude falls over on some of this without the
prompts.

If that's something we want:

Reported-by: kreview-c94b85d6d2