lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d7735944-76ab-065d-dbcd-796087ae3f8d@hisilicon.com>
Date: Fri, 2 Aug 2024 10:09:29 +0800
From: Junxian Huang <huangjunxian6@...ilicon.com>
To: Bart Van Assche <bvanassche@....org>, <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 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.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ