From: Mike Christie Date: Fri, 7 Feb 2014 06:41:42 +0000 (-0600) Subject: [SCSI] iscsi_tcp: check for valid session before accessing X-Git-Tag: v3.15-rc1~136^2~58 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=eee2b5c840d93f704554f4a2884cef72742f22e2;p=karo-tx-linux.git [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 Signed-off-by: James Bottomley --- 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) {