All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check sk before sendpage
@ 2019-07-10  7:30 Yang Bin
       [not found] ` <1562743809-31133-1-git-send-email-yang.bin18-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Yang Bin @ 2019-07-10  7:30 UTC (permalink / raw)
  To: lduncan
  Cc: cleech, jejb, martin.petersen, open-iscsi, linux-scsi,
	linux-kernel, xue.zhihong, wang.yi59, wang.liang82, Yang Bin

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-11  7:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-10  7:30 [PATCH] Check sk before sendpage Yang Bin
     [not found] ` <1562743809-31133-1-git-send-email-yang.bin18-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
2019-07-10 17:47   ` Lee Duncan
2019-07-10 17:47     ` Lee Duncan
2019-07-10 18:52     ` James Bottomley
     [not found]       ` <1562784731.3213.98.camel-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
2019-07-11  7:42         ` yang.bin18-Th6q7B73Y6EnDS1+zs4M5A

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.