From: Yang Bin <yang.bin18@zte.com.cn>
To: lduncan@suse.com
Cc: cleech@redhat.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, open-iscsi@googlegroups.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn,
wang.liang82@zte.com.cn, " Yang Bin " <yang.bin18@zte.com.cn>
Subject: [PATCH] Check sk before sendpage
Date: Wed, 10 Jul 2019 15:30:09 +0800 [thread overview]
Message-ID: <1562743809-31133-1-git-send-email-yang.bin18@zte.com.cn> (raw)
From: " Yang Bin "<yang.bin18@zte.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@zte.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;
--
1.8.3.1
next reply other threads:[~2019-07-10 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 7:30 Yang Bin [this message]
2019-07-10 17:47 ` Lee Duncan
2019-07-10 18:52 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1562743809-31133-1-git-send-email-yang.bin18@zte.com.cn \
--to=yang.bin18@zte.com.cn \
--cc=cleech@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=lduncan@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=open-iscsi@googlegroups.com \
--cc=wang.liang82@zte.com.cn \
--cc=wang.yi59@zte.com.cn \
--cc=xue.zhihong@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®