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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bff7565b-7159-e8f4-e8f5-711994f95056@fujitsu.com>
Date:   Wed, 31 Aug 2022 03:16:28 +0000
From:   "yangx.jy@...itsu.com" <yangx.jy@...itsu.com>
To:     Bart Van Assche <bvanassche@....org>,
        "jgg@...dia.com" <jgg@...dia.com>,
        "leon@...nel.org" <leon@...nel.org>
CC:     "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] RDMA/srp: Set scmnd->result only when scmnd is not NULL

On 2022/8/31 10:47, Bart Van Assche wrote:
> On 8/30/22 18:47, yangx.jy@...itsu.com wrote:
>> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c 
>> b/drivers/infiniband/ulp/srp/ib_srp.c
>> index 7720ea270ed8..528cdd0daba4 100644
>> --- a/drivers/infiniband/ulp/srp/ib_srp.c
>> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
>> @@ -1961,6 +1961,7 @@ static void srp_process_rsp(struct srp_rdma_ch 
>> *ch, struct srp_rsp *rsp)
>>           if (scmnd) {
>>               req = scsi_cmd_priv(scmnd);
>>               scmnd = srp_claim_req(ch, req, NULL, scmnd);
>> +            scmnd->result = rsp->status;
>>           } else {
>>               shost_printk(KERN_ERR, target->scsi_host,
>>                        "Null scmnd for RSP w/tag %#016llx received on 
>> ch %td / QP %#x\n",
>> @@ -1972,7 +1973,6 @@ static void srp_process_rsp(struct srp_rdma_ch 
>> *ch, struct srp_rsp *rsp)
>>               return;
>>           }
>> -        scmnd->result = rsp->status;
>>           if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
>>               memcpy(scmnd->sense_buffer, rsp->data +
> 
> Since there is a 'return' statement in the else branch, I don't see how 
> this patch can make a difference?

Hi Bart,

Sorry, I didn't make the right fix. I will send v2 patch.
I think scmnd may be set to NULL after srp_claim_req() is called and 
then setting scmnd->result can trigger the NULL pointer dereference.

Best Regards,
Xiao Yang
> 
> Thanks,
> 
> Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ