Re: [PATCH v3] RDMA/mlx5: Preserve DEVX objects after failed output copy

From: Jason Gunthorpe

Date: Tue Dec 01 2026 - 12:16:40 EST


On Tue, Dec 01, 2026 at 05:30:00PM +0200, Leon Romanovsky wrote:
> On Fri, Nov 27, 2026 at 03:10:55AM +0000, Jaeyeong Lee wrote:
> > A DEVX create command can succeed before indirect mkey registration or
> > copying the command output to userspace fails. The current unwind path
> > destroys the hardware object directly, ignores a destroy failure, and
> > frees struct devx_obj.
> >
> > If the object cannot be destroyed,
>
> How can this happen? This is exactly why your reproducer is invalid, it
> does not account for how real hardware behaves.

It definately can happen, I gave an example intending him to paste it
over..

You can create a PD with devx, stall the kernel thread through various
well known means and then make the copy fail.

During the stall you guess the PDN and create a MR within it.

Now FW will not destroy the object due to its refcounting.

There are probably many examples beyond this.

The patch looks OK to me and the code now matches how this was
expected to be used, with finalize preceeding a manual copy to user.

Jason