summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2014-02-07 07:41:42 +0100
committerJames Bottomley <JBottomley@Parallels.com>2014-03-15 18:19:19 +0100
commiteee2b5c840d93f704554f4a2884cef72742f22e2 (patch)
tree48754404f215a393fa2025e997357edeb7e9ea75 /drivers/scsi/iscsi_tcp.c
parent[SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset() (diff)
downloadlinux-eee2b5c840d93f704554f4a2884cef72742f22e2.tar.xz
linux-eee2b5c840d93f704554f4a2884cef72742f22e2.zip
[SCSI] iscsi_tcp: check for valid session before accessing
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>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 12b351213c59..bfb6d07d87f0 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) {