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: <EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915DF66B3@dggeml505-mbs.china.huawei.com>
Date:   Tue, 29 Oct 2019 08:07:49 +0000
From:   "wubo (T)" <wubo40@...wei.com>
To:     Lee Duncan <LDuncan@...e.com>,
        "cleech@...hat.com" <cleech@...hat.com>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "open-iscsi@...glegroups.com" <open-iscsi@...glegroups.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Mingfangsen <mingfangsen@...wei.com>,
        "liuzhiqiang (I)" <liuzhiqiang26@...wei.com>
Subject: 答复: [PATCH] scsi: avoid potential deadloop in iscsi_if_rx func

On 2019/10/29 2:04, Lee Duncan wrote:
> On 10/26/19 1:55 AM, wubo (T) wrote:
>> From: Bo Wu <wubo40@...wei.com>
>>
>> In iscsi_if_rx func, after receiving one request through 
>> iscsi_if_recv_msg func,iscsi_if_send_reply will be called to try to 
>> reply the request in do-loop. If the return of iscsi_if_send_reply 
>> func fails all the time, one deadloop will occur.
>>
>> Signed-off-by: Bo Wu <wubo40@...wei.com>
>> Reviewed-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
>> ---
>>  drivers/scsi/scsi_transport_iscsi.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/scsi/scsi_transport_iscsi.c 
>> b/drivers/scsi/scsi_transport_iscsi.c
>> index 417b868d8735..f377bfed6b0c 100644
>> --- a/drivers/scsi/scsi_transport_iscsi.c
>> +++ b/drivers/scsi/scsi_transport_iscsi.c
>> @@ -24,6 +24,8 @@
>>  
>>  #define ISCSI_TRANSPORT_VERSION "2.0-870"
>>  
>> +#define ISCSI_SEND_MAX_ALLOWED     10
>> +
>>  #define CREATE_TRACE_POINTS
>>  #include <trace/events/iscsi.h>
>>  
>> @@ -3682,6 +3684,7 @@ iscsi_if_rx(struct sk_buff *skb)
>>  		struct nlmsghdr	*nlh;
>>  		struct iscsi_uevent *ev;
>>  		uint32_t group;
>> +		int retries = ISCSI_SEND_MAX_ALLOWED;
>>  
>>  		nlh = nlmsg_hdr(skb);
>>  		if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) || @@ -3710,8 
>> +3713,11 @@ iscsi_if_rx(struct sk_buff *skb)
>>  				break;
>>  			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
>>  				break;
>> +			if (retries <= 0)
>> +				break;
>>  			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
>>  						  ev, sizeof(*ev));
>> +			retries--;
>>  		} while (err < 0 && err != -ECONNREFUSED && err != -ESRCH);
>>  		skb_pull(skb, rlen);
>>  	}
>>
> 
> You could have used "if (--retries < 0)" (or some variation thereof) 
> but that may not be as clear, and certainly is only a nit. So I'm fine 
> with that.
> 

Thanks for your suggestion, I will modify it in v2 patch.

> But I would like to see some sort of error or even debug kernel 
> message if we time out waiting to receive a response. Otherwise, how 
> will some human diagnose this problem?
>

You are right, I will add some sort of error or debug kernel message in the v2 patch.

Thanks,
Bo Wu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ