From: Bart Van Assche <bvanassche@acm.org>
To: Serhat Kumral <serhatkumral1@gmail.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/srp: Avoid reading uninitialized has_port on srp_parse_in() failure
Date: Fri, 16 Oct 2026 14:23:29 -0700 [thread overview]
Message-ID: <6bf686e3-ee95-4055-9912-a77262716450@acm.org> (raw)
In-Reply-To: <20261016211509.12973-1-serhatkumral1@gmail.com>
On 10/16/26 2:15 PM, Serhat Kumral wrote:
> srp_parse_in() returns -ENOMEM without initializing *has_port if
> kstrdup() fails. Only check has_port when srp_parse_in() succeeds.
>
> Fixes: bcef5b721568 ("RDMA/srp: Accept again source addresses that do not have a port number")
> Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
> ---
> found by smatch:
> - drivers/infiniband/ulp/srp/ib_srp.c:3502 srp_parse_options() error: uninitialized symbol 'has_port'.
>
> drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 955f36efeebd..5811f02df980 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -3499,7 +3499,7 @@ static int srp_parse_options(struct net *net, const char *buf,
> }
> ret = srp_parse_in(net, &target->rdma_cm.dst.ss, p,
> &has_port);
> - if (!has_port)
> + if (ret == 0 && !has_port)
> ret = -EINVAL;
> if (ret < 0) {
> pr_warn("bad dest parameter '%s'\n", p);
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
prev parent reply other threads:[~2026-10-16 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 21:15 Serhat Kumral
2026-10-16 21:23 ` Bart Van Assche [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=6bf686e3-ee95-4055-9912-a77262716450@acm.org \
--to=bvanassche@acm.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--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
all inboxes | Powered by JetHome®