• Bart Van Assche's avatar
    RDMA/srpt: Fix TPG creation · 79d81ef4
    Bart Van Assche authored
    Unlike the iSCSI target driver, for the SRP target driver it is sufficient
    if a single TPG can be associated with each RDMA port name. However, users
    started associating multiple TPGs with RDMA port names. Support this by
    converting the single TPG in struct srpt_port_id into a list. This patch
    fixes the following list corruption issue:
    
     list_add corruption. prev->next should be next (ffffffffc0a080c0), but was ffffa08a994ce6f0. (prev=ffffa08a994ce6f0).
     WARNING: CPU: 2 PID: 2597 at lib/list_debug.c:28 __list_add_valid+0x6a/0x70
     CPU: 2 PID: 2597 Comm: targetcli Not tainted 5.4.0-rc1.3bfa3c9602a7 #1
     RIP: 0010:__list_add_valid+0x6a/0x70
     Call Trace:
      core_tpg_register+0x116/0x200 [target_core_mod]
      srpt_make_tpg+0x3f/0x60 [ib_srpt]
      target_fabric_make_tpg+0x41/0x290 [target_core_mod]
      configfs_mkdir+0x158/0x3e0
      vfs_mkdir+0x108/0x1a0
      do_mkdirat+0x77/0xe0
      do_syscall_64+0x55/0x1d0
      entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    Link: https://lore.kernel.org/r/20191023204106.23326-1-bvanassche@acm.orgReported-by: default avatarHonggang LI <honli@redhat.com>
    Fixes: a42d985b ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Acked-by: default avatarHonggang Li <honli@redhat.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    79d81ef4
ib_srpt.c 104 KB