Re: [PATCH 2/2] RDMA/nldev: Guard against NULL ucontext in resource dumps

Jason Gunthorpe <[email protected]>
Newsgroups org.kernel.vger.linux-rdma,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, Aug 11, 2026 at 06:56:23PM +0800, Yili Zhang wrote:
> +	/*
> +	 * The uobject's context is cleared by uverbs_destroy_uobject() during
> +	 * the RDMA_REMOVE_DRIVER_FAILURE fallback path, while the CQ itself is
> +	 * leaked in the restrack xarray (its destroy failed, so neither the HW
> +	 * CQ nor the restrack entry can be torn down). A concurrent dump must
> +	 * not oops when it stumbles onto such a half-destroyed user CQ.
> +	 */
> +	if (!rdma_is_kernel_res(res)) {
> +		struct ib_ucontext *ctx =
> +			READ_ONCE(cq->uobject->uevent.uobject.context);
> +
> +		if (ctx && nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_CTXN,
> +				       ctx->res.id))
> +			return -EMSGSIZE;
> +	}

It is missing locking right? This needs to run under the disassociate
srcu probably

Jason
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.