From 0a01b504e05e004670f737a6169e273a0cce08e7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 Mar 2019 03:58:30 +0000 Subject: [PATCH] iscsi-isert: Avoid that reading the target_ip sysfs attribute triggers a kernel oops conn->sock is set by the TCP/IP transport but not by the iSER transport. Hence check the conn->sock pointer from common code before dereferencing it. Reported-by: Doug Dumitru git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8051 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/conn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index fd16e3097..fb5231fc6 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -125,6 +125,9 @@ static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, TRACE_ENTRY(); + if (!conn->sock) + return -ENOENT; + sk = conn->sock->sk; switch (sk->sk_family) { case AF_INET: