[SCSI] iscsi_tcp: check for valid session before accessing
authorMike Christie <michaelc@cs.wisc.edu>
Fri, 7 Feb 2014 06:41:42 +0000 (00:41 -0600)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 15 Mar 2014 17:19:19 +0000 (10:19 -0700)
Check that the session is setup before accessing its
connection. This fixes a oops where userspace tries
to get the ip address before the session is bound to
a host.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/iscsi_tcp.c

index 12b3512..bfb6d07 100644 (file)
@@ -759,6 +759,9 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
 
        switch (param) {
        case ISCSI_HOST_PARAM_IPADDRESS:
+               if (!session)
+                       return -ENOTCONN;
+
                spin_lock_bh(&session->frwd_lock);
                conn = session->leadconn;
                if (!conn) {