[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1bc364ff-5bff-47ac-611a-f75c43f4bd1b@suse.com>
Date: Wed, 10 Jul 2019 17:47:31 +0000
From: Lee Duncan <LDuncan@...e.com>
To: Yang Bin <yang.bin18@....com.cn>
CC: "open-iscsi@...glegroups.com" <open-iscsi@...glegroups.com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"cleech@...hat.com" <cleech@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"wang.liang82@....com.cn" <wang.liang82@....com.cn>,
"wang.yi59@....com.cn" <wang.yi59@....com.cn>,
"xue.zhihong@....com.cn" <xue.zhihong@....com.cn>
Subject: Re: [PATCH] Check sk before sendpage
On 7/10/19 12:30 AM, Yang Bin wrote:
> From: " Yang Bin "<yang.bin18@....com.cn>
>
> Before xmit,iscsi may disconnect just now.
> So must check connection sock NULL or not,or kernel will crash for
> accessing NULL pointer.
>
> Signed-off-by: Yang Bin <yang.bin18@....com.cn>
> ---
> drivers/scsi/iscsi_tcp.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
> index 7bedbe8..a59c49f 100644
> --- a/drivers/scsi/iscsi_tcp.c
> +++ b/drivers/scsi/iscsi_tcp.c
> @@ -264,6 +264,9 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn,
> unsigned int copied = 0;
> int r = 0;
>
> + if (!sk)
> + return -ENOTCONN;
> +
> while (!iscsi_tcp_segment_done(tcp_conn, segment, 0, r)) {
> struct scatterlist *sg;
> unsigned int offset, copy;
>
If the socket can be closed right before iscsi_sw_tcp_xmit_segment() is
called, can it be called in the middle of sending segments? (In which
case the check would have to be in the while loop.)
--
Lee Duncan
Powered by blists - more mailing lists