From: Mike Christie <micha...@cs.wisc.edu>

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 <micha...@cs.wisc.edu>
---
 drivers/scsi/iscsi_tcp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 12b3512..bfb6d07 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -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) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to