Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Junyoung Jang" <graypanda.inzag@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/iwpm: fix memory leak in iwpm_add_remote_info()
Date: Mon, 09 Nov 2026 20:15:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-205560@kernel.org> (raw)
In-Reply-To: <20261109200330.2361828-1-graypanda.inzag@gmail.com>

> NETLINK_RDMA accepts requests addressed to kernel port ID 0 from a local
> unprivileged socket. The IWCM RDMA_NL_IWPM_REMOTE_INFO callback has no
> RDMA_NL_ADMIN_PERM flag, and RDMA netlink routes this IWCM opcode to its
> dump callback even without NLM_F_DUMP.
> 
> iwpm_remote_info_cb() parses the six required attributes and only checks
> that the local and mapped-local sockaddr_storage families match and that
> the remote and mapped-remote families match. Four family-255 addresses
> pass those checks. The callback allocates an iwpm_remote_info object
> with GFP_ATOMIC and passes it to iwpm_add_remote_info(). There,
> get_reminfo_hash_bucket() accepts only AF_INET and AF_INET6, so the
> family-255 lookup returns NULL. The object is neither linked into
> iwpm_reminfo_bucket nor freed, and the callback returns -EINVAL after
> this allocation side effect.
> 
> iwpm_exit() only walks and frees linked hash entries, so closing the
> netlink socket does not recover these orphaned objects. As a result, an
> unprivileged local user in the initial network namespace can repeatedly
> send this request without CAP_NET_ADMIN to permanently leak unreclaimable
> kernel slab memory (kmalloc-512), leading to memory exhaustion and a
> denial of service (DoS).
> 
> Initialize hash_bucket_head to NULL and, after the spinlock is released,
> free rem_info if no bucket accepted it. Freeing after unlock also covers
> the absent-table case without changing the protected list operation and
> follows the existing null-bucket cleanup pattern in iwpm_add_mapinfo().
> 
> Fixes: 6eec17746175 ("RDMA/core: Enable the iWarp Port Mapper to provide the actual address of the connecting peer to its clients")
> Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109200330.2361828-1-graypanda.inzag@gmail.com?part=1


      reply	other threads:[~2026-11-09 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 20:03 [PATCH] RDMA/iwpm: fix memory leak in iwpm_add_remote_info() Junyoung Jang
2026-11-09 20:15 ` sashiko-bot [this message]

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=sashiko-outbox-205560@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=graypanda.inzag@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox