Re: [PATCH 1/1] RDMA/cma: Fix WARNING in res_to_rt

Jason Gunthorpe <[email protected]>
Newsgroups org.kernel.vger.linux-rdma
Message-ID <[email protected]>
On Mon, Aug 10, 2026 at 03:53:57AM +0200, Zhu Yanjun wrote:
> @@ -3531,7 +3531,8 @@ static void addr_handler(int status, struct sockaddr *src_addr,
>  		if (status)
>  			pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to acquire device. status %d\n",
>  					     status);
> -		rdma_restrack_add(&id_priv->res);
> +		if (id_priv->id.device)
> +			rdma_restrack_add(&id_priv->res);
>  	} else if (status) {
>  		pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to resolve IP. status %d\n", status);
>  	}

The full text is:

	if (!status && !id_priv->cma_dev) {
		status = cma_acquire_dev_by_src_ip(id_priv);
		if (status)
			pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to acquire device. status %d\n",
					     status);
		rdma_restrack_add(&id_priv->res);

What it is trying to do is fill in cma_dev/id.device (they are
linked).

'if (status)' means the resolution failed and the cm_id is not
populated, so it should just be if/else instead of trying to check
id.device

But this does seem to be the bug syzkaller is pointing at, but the
commit message seems really strange.

If status is !0 then we know id.device is NULL and we cannot add this
to restrack. Otherwise it must be !NULL and it must be safe to add it
or we have a locking problem.

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.