From: Junxian Huang <huangjunxian6@hisilicon.com>
To: Bart Van Assche <bvanassche@acm.org>, <jgg@ziepe.ca>,
<leon@kernel.org>, <nab@risingtidesystems.com>
Cc: <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>,
<linux-kernel@vger.kernel.org>, <target-devel@vger.kernel.org>
Subject: Re: [PATCH v2 for-rc] RDMA/srpt: Fix UAF when srpt_add_one() failed
Date: Fri, 2 Aug 2024 10:09:29 +0800 [thread overview]
Message-ID: <d7735944-76ab-065d-dbcd-796087ae3f8d@hisilicon.com> (raw)
In-Reply-To: <98763329-897a-4f91-ab08-62bbd6afc8ec@acm.org>
On 2024/8/2 0:20, Bart Van Assche wrote:
> On 8/1/24 5:32 AM, Junxian Huang wrote:
>> Besides, exchange the order of INIT_WORK() and srpt_refresh_port()
>> in srpt_add_one(), so that when srpt_refresh_port() failed, there
>> is no need to cancel the work in this iteration.
>
> The above description is wrong. There is no need to cancel work after
> INIT_WORK() has been called if the work has never been queued. Hence,
> moving the INIT_WORK() call is not necessary.
>
Well, inspired by your comment I looked into the code again and I think
perhaps this whole patch is not necessary.
I encountered this problem in 5.10 kernel, where ib_register_event_handler()
was called before the for-loop. But this bug has been fixed in the current
mainline, and the work won't be queued until the whole for-loop is finished.
Thanks,
Junxian
>> @@ -3220,7 +3221,6 @@ static int srpt_add_one(struct ib_device *device)
>> sport->port_attrib.srp_max_rsp_size = DEFAULT_MAX_RSP_SIZE;
>> sport->port_attrib.srp_sq_size = DEF_SRPT_SQ_SIZE;
>> sport->port_attrib.use_srq = false;
>> - INIT_WORK(&sport->work, srpt_refresh_port_work);
>> ret = srpt_refresh_port(sport);
>> if (ret) {
>> @@ -3229,6 +3229,8 @@ static int srpt_add_one(struct ib_device *device)
>> i--;
>> goto err_port;
>> }
>> +
>> + INIT_WORK(&sport->work, srpt_refresh_port_work);
>> }
>
> I don't think that this change is necessary.
>
> Bart.
>
prev parent reply other threads:[~2024-08-02 2:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 12:32 [PATCH v2 for-rc] RDMA/srpt: Fix UAF when srpt_add_one() failed Junxian Huang
2024-08-01 16:20 ` Bart Van Assche
2024-08-02 2:09 ` Junxian Huang [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=d7735944-76ab-065d-dbcd-796087ae3f8d@hisilicon.com \
--to=huangjunxian6@hisilicon.com \
--cc=bvanassche@acm.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=nab@risingtidesystems.com \
--cc=target-devel@vger.kernel.org \
/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