[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>
This commit is contained in:
Mike Christie 2014-02-07 00:41:42 -06:00 committed by James Bottomley
parent 9cb48e7b9e
commit eee2b5c840
1 changed files with 3 additions and 0 deletions

View File

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