Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Serhat Kumral" <serhatkumral1@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v4] RDMA/srpt: Reject an srp_sq_size that does not fit in a CQ
Date: Fri, 25 Sep 2026 21:50:26 +0000	[thread overview]
Message-ID: <20260925215026.C882F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260925213629.8039-1-serhatkumral1@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ib_srpt: UAF in configfs store due to hot-unplug race
--

commit 1f57db75193afbb14a2edb4aa5126369171bf0a9
Author: Serhat Kumral <serhatkumral1@gmail.com>

RDMA/srpt: Reject an srp_sq_size that does not fit in a CQ

This commit modifies the configfs store function for srp_sq_size to validate
the requested size against the device's max_cqe limit, preventing continuous
CQ allocation failures that can lead to memory exhaustion.

> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -3603,6 +3603,8 @@ static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item,
>  {
>  	struct se_portal_group *se_tpg = attrib_to_tpg(item);
>  	struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
> +	const struct ib_device_attr *attrs = &sport->sdev->device->attrs;
> +	u32 rq_size = min(attrs->max_qp_wr, MAX_SRPT_RQ_SIZE);

[Severity: High]
Is it safe to unconditionally dereference sport->sdev->device here?

If an InfiniBand device is hot-removed, srpt_remove_one() drops the driver's
reference to sdev, but configfs items created via srpt_make_tport() can hold
additional references, keeping the sport structure alive.

Once srpt_remove_one() returns, the IB core drops its reference to the
ib_device, freeing it. If a user writes to the srp_sq_size configfs
attribute during or after this process, couldn't this access the freed
ib_device and trigger a use-after-free?

[ ... ]

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

      reply	other threads:[~2026-09-25 21:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 21:36 [PATCH v4] RDMA/srpt: Reject an srp_sq_size that does not fit in a CQ Serhat Kumral
2026-09-25 21:50 ` 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=20260925215026.C882F1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=serhatkumral1@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