Re: [PATCH v2 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 Tue, Aug 11, 2026 at 12:01:23AM +0200, Zhu Yanjun wrote:
> id_priv->cma_dev and bind the associated ib_device to id_priv->id.device.
> If cma_acquire_dev_by_src_ip() returns an error (non-zero status), the ID
> remains unassociated with any RDMA device.
> 
> Previously, rdma_restrack_add(&id_priv->res) was invoked unconditionally
> even when cma_acquire_dev_by_src_ip() failed, passing a resource with a
> NULL dev pointer and triggering the WARN_ON assertion in res_to_rt().
> 
> Fix this by only adding the resource to restrack when acquiring the device
> succeeds.
> 
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=72eddfbadda3e3928e72
> Tested-by: [email protected]
> Fixes: cb5cd0ea4eb3 ("RDMA/core: Add CM to restrack after successful attachment to a device")
> 
> Signed-off-by: Zhu Yanjun <[email protected]>
> ---
> V1 -> V2: Follow Jason's advice to use if/else to handle this problem.
> ---
>  drivers/infiniband/core/cma.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied to for-next, thanks

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.