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: <5EE8178C.9090005@huawei.com>
Date:   Tue, 16 Jun 2020 08:51:24 +0800
From:   Jing Xiangfeng <jingxiangfeng@...wei.com>
To:     Bart Van Assche <bvanassche@....org>, <dledford@...hat.com>,
        <jgg@...pe.ca>
CC:     <linux-rdma@...r.kernel.org>, <target-devel@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: Re: [PATCH] IB/srpt: Fix a potential null pointer dereference



On 2020/6/15 21:37, Bart Van Assche wrote:
> On 2020-06-15 02:12, Jing Xiangfeng wrote:
>> In srpt_cm_req_recv(), it is possible that sdev is NULL,
>> so we should test sdev before using it.
>>
>> Signed-off-by: Jing Xiangfeng <jingxiangfeng@...wei.com>
>> ---
>>   drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
>> index 98552749d71c..72053254bf84 100644
>> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
>> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
>> @@ -2143,7 +2143,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
>>   			    const struct srp_login_req *req,
>>   			    const char *src_addr)
>>   {
>> -	struct srpt_port *sport = &sdev->port[port_num - 1];
>> +	struct srpt_port *sport;
>>   	struct srpt_nexus *nexus;
>>   	struct srp_login_rsp *rsp = NULL;
>>   	struct srp_login_rej *rej = NULL;
>> @@ -2162,6 +2162,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
>>   	if (WARN_ON(!sdev || !req))
>>   		return -EINVAL;
>>
>> +	sport = &sdev->port[port_num - 1];
>>   	it_iu_len = be32_to_cpu(req->req_it_iu_len);
>>
>
> Please remove the (!sdev || !req) check instead of making the above
> change. It's easy to show that both pointers are always valid.

OK, I will send a v2 with this change.

Thanks
>
> Thanks,
>
> Bart.
> .
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ