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 <doug@easyco.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8051 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-03-11 03:58:30 +00:00
parent d1f7b0aae8
commit 0a01b504e0
+3
View File
@@ -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: