Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Junxian Huang <huangjunxian6@hisilicon.com>,
	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: Thu, 1 Aug 2024 09:20:45 -0700	[thread overview]
Message-ID: <98763329-897a-4f91-ab08-62bbd6afc8ec@acm.org> (raw)
In-Reply-To: <20240801123253.2908831-1-huangjunxian6@hisilicon.com>

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.

> @@ -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.


  reply	other threads:[~2024-08-01 16:20 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 [this message]
2024-08-02  2:09   ` Junxian Huang

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=98763329-897a-4f91-ab08-62bbd6afc8ec@acm.org \
    --to=bvanassche@acm.org \
    --cc=huangjunxian6@hisilicon.com \
    --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