All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Allison Henderson" <achender@kernel.org>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next] net/rds: restrict the rdma_cm ids to IB devices
Date: Fri, 18 Sep 2026 07:41:19 +0000	[thread overview]
Message-ID: <20260918074120.1D5901F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917074108.174262-1-achender@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rds: memory leak of rdma_cm_id in rds_ib_conn_path_connect error path
--

commit 09995cfa814e39bb6b39d83f2fc5b812b28b6fcc
Author: Allison Henderson <achender@kernel.org>

net/rds: restrict the rdma_cm ids to IB devices

This commit restricts the RDS RDMA connection IDs to IB devices by utilizing
the rdma_restrict_node_type API. It adds calls to this function during
listener initialization, probe check, and connection path setup to ensure
the CMA IDs are strictly bound to RDMA_NODE_IB_CA nodes.

> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index 4feb0edc360c8..a859c252fd9a7 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
[ ... ]
> @@ -999,6 +999,16 @@ int rds_ib_conn_path_connect(struct rds_conn_path *cp)
>  		goto out;
>  	}
>  
> +	/* rds_ib_laddr_check() only vouched for the local address being
> +	 * on an IB device; the address resolution below picks the device
> +	 * on its own, so restrict it to the same kind.
> +	 */
> +	ret = rdma_restrict_node_type(ic->i_cm_id, RDMA_NODE_IB_CA);
> +	if (ret) {
> +		rdsdebug("rdma_restrict_node_type() failed: %d\n", ret);
> +		goto out;

[Severity: Low]
Does this error path leak the rdma_cm_id resource?

When rdma_restrict_node_type() fails here, the code jumps to the 'out'
label and returns without destroying the newly allocated ic->i_cm_id. By
contrast, if the subsequent rdma_resolve_addr() call fails, the code
explicitly cleans up with rdma_destroy_id(ic->i_cm_id) and sets it to NULL
before returning.

While rdma_restrict_node_type() currently deterministically returns 0 for a
newly allocated ID (since it is in the RDMA_CM_IDLE state and using a valid
node type), should this error path also clean up the ID to prevent future
resource leaks if the restriction logic changes?

> +	}
> +
>  	rdsdebug("created cm id %p for conn %p\n", ic->i_cm_id, conn);
>  
>  	if (ipv6_addr_v4mapped(&conn->c_faddr)) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917074108.174262-1-achender@kernel.org?part=1

  reply	other threads:[~2026-09-18  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  7:41 [PATCH net-next] net/rds: restrict the rdma_cm ids to IB devices Allison Henderson
2026-09-18  7:41 ` sashiko-bot [this message]
2026-09-21  8:37 ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918074120.1D5901F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=achender@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.