From: sashiko-bot@kernel.org
To: "Suyuan Wang" <shyckless@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/mthca: Free the AV table index if kmalloc fails in create_ah
Date: Mon, 23 Nov 2026 00:48:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-228490@kernel.org> (raw)
In-Reply-To: <20261123-mthca-v1-1-506d3c3a7d4e@gmail.com>
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> When an address handle can be stored in HCA memory, mthca_create_ah()
> first takes an index from the AV table and then allocates a temporary
> AV buffer:
>
> index = mthca_alloc(&dev->av_table.alloc);
> ...
> av = kmalloc_obj(*av, GFP_ATOMIC);
> if (!av)
> goto on_hca_fail;
>
> If the allocation fails, the code falls back to the PCI pool and
> ah->type stays MTHCA_AH_PCI_POOL. mthca_destroy_ah() then frees the
> pool entry but never the AV table index, so the index is lost for
> good. The allocation is GFP_ATOMIC, so it can fail under memory
> pressure, and repeated failures can exhaust the free on-HCA AV indices
> until no new on-HCA address handle can be created.
>
> Return the index to the allocator before falling back.
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-mthca-v1-1-506d3c3a7d4e@gmail.com?part=1
prev parent reply other threads:[~2026-11-23 0:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 0:43 [PATCH] RDMA/mthca: Free the AV table index if kmalloc fails in create_ah Suyuan Wang via B4 Relay
2026-11-23 0:48 ` 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-228490@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shyckless@gmail.com \
/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