[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <98763329-897a-4f91-ab08-62bbd6afc8ec@acm.org>
Date: Thu, 1 Aug 2024 09:20:45 -0700
From: Bart Van Assche <bvanassche@....org>
To: Junxian Huang <huangjunxian6@...ilicon.com>, jgg@...pe.ca,
leon@...nel.org, nab@...ingtidesystems.com
Cc: linux-rdma@...r.kernel.org, linuxarm@...wei.com,
linux-kernel@...r.kernel.org, target-devel@...r.kernel.org
Subject: Re: [PATCH v2 for-rc] RDMA/srpt: Fix UAF when srpt_add_one() failed
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.
Powered by blists - more mailing lists