Re: Multiple Connections LIO Target Failing in Initial Login Request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2014-05-29 at 13:25 +0530, Santosh Kulkarni wrote:
> Hi Nab,
> 
> Am trying to login through multiple connections in a Session. However 
> after the login succeeds on the leading connection the subsequent 
> connections in the session fail to succeed in the initial login requests 
> and hence login fails on subsequent connections.
> 
> I looked into the code and i see that a kmalloc  for a "tmpbuf" fails 
> for the initial login request processing.
> 
> Here's the dmesg.
> 
> [872129.660613] Unable to allocate memory for tmpbuf.
> [872129.660619] iSCSI Login negotiation failed.
> 
> PFA the pcap for the entire login process.
> I see the following issue with both my code for a Linux initiator and as 
> well a Windows Standard Initiator.
> 
> 
> Target Kernel:
> # uname -r
> 3.14.0-rc6+
> 
> cat /sys/kernel/config/target/version
> Target Engine Core ConfigFS Infrastructure v4.1.0 on Linux/x86_64 on 
> 3.14.0-rc6+
> 
> 
> Am i looking at a possible issue.Please comment.
> 

Indeed.  Here is the patch that I'm applying to address this bug:

commit 39f06a511345d60163594d08ff3735990cabbd1d
Author: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date:   Thu May 29 12:36:43 2014 -0700

    iscsi-target: Fix incorrect buffer usage in non-leading connection login
    
    This patch fixes a bug in non-leading connection login processing where
    iscsi_login_non_zero_tsih_s2() was incorrectly using the login request
    header as a temporary buffer for setting TargetPortalGroupTag.
    
    This bug was manifesting itself as login failures with non-leading with
    multiple connection per session (MC/S) operation.
    
    Reported-by: Santosh Kulkarni <santosh.kulkarni@xxxxxxxxxxxxxx>
    Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_lo
index ca31fa1..bb76197 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -550,13 +550,14 @@ static int iscsi_login_non_zero_tsih_s1(
  */
 static int iscsi_login_non_zero_tsih_s2(
        struct iscsi_conn *conn,
-       unsigned char *buf)
+       unsigned char *p)
 {
        struct iscsi_portal_group *tpg = conn->tpg;
        struct iscsi_session *sess = NULL, *sess_p = NULL;
        struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
        struct se_session *se_sess, *se_sess_tmp;
-       struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf;
+       struct iscsi_login_req *pdu = (struct iscsi_login_req *)p;
+       unsigned char buf[32];
        bool iser = false;
 
        spin_lock_bh(&se_tpg->session_lock);


Interestingly enough, this bug in iscsi_login_non_zero_tsih_s1() has
been around for a long time, but only appears to be getting triggered
recently with the v3.10 changes to support iser-target.

Regardless, thanks for reporting.

--nab

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




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux