1. 17 7月, 2012 29 次提交
  2. 15 7月, 2012 1 次提交
    • M
      tcm_fc: Fix crash seen with aborts and large reads · 3cc5d2a6
      Mark Rustad 提交于
      This patch fixes a crash seen when large reads have their exchange
      aborted by either timing out or being reset. Because the exchange
      abort results in the seq pointer being set to NULL, because the
      sequence is no longer valid, it must not be dereferenced. This
      patch changes the function ft_get_task_tag to return ~0 if it is
      unable to get the tag for this reason. Because the get_task_tag
      interface provides no means of returning an error, this seems
      like the best way to fix this issue at the moment.
      Signed-off-by: NMark Rustad <mark.d.rustad@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3cc5d2a6
  3. 07 7月, 2012 2 次提交
  4. 13 6月, 2012 8 次提交
    • S
      qla2xxx: Remove version.h header file inclusion · 5134de28
      Sachin Kamat 提交于
      version.h header file is no longer required for qla_target code.
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5134de28
    • R
      tcm_qla2xxx: Handle malformed wwn strings properly · d4f75b56
      Roland Dreier 提交于
      If we make a variable an unsigned int and then expect it to be < 0 on
      a bad character, we're going to have a bad time.  Fix the tcm_qla2xxx
      code to actually notice if hex_to_bin() returns a negative variable.
      
      This was detected by the compiler warning:
      
          scsi/qla2xxx/tcm_qla2xxx.c: In function ‘tcm_qla2xxx_npiv_extract_wwn’:
          scsi/qla2xxx/tcm_qla2xxx.c:148:3: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d4f75b56
    • R
    • R
      qla2xxx: Don't leak commands we give up on in qlt_do_work() · fae9eaf8
      Roland Dreier 提交于
      If we go to the "out_term:" exit path in qlt_do_work(), we call
      qlt_send_term_exchange() with a NULL cmd, which means that it can't
      possibly free the cmd for us.  Add an explicit call to free the
      command memory, so we don't leak the allocation.
      
      This will also fix warnings about "BUG qla_tgt_cmd_cachep: Objects
      remaining on kmem_cache_close" from slub when unloading the qla2xxx
      target module.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fae9eaf8
    • R
      qla2xxx: Don't crash if we can't find cmd for failed CTIO · 092e1dc3
      Roland Dreier 提交于
      In qlt_do_ctio_completion(), there's no point in calling
      qlt_term_ctio_exchange() with a NULL cmd -- all that it does is crash
      in a NULL pointer dereference, since it does
      
      	qlt_send_term_exchange(vha, cmd, &cmd->atio, 1);
      
      and dereferencing &cmd->atio is a bad idea if cmd itself is NULL.
      
      If we really need to do this, we could take the values from the
      failed CTIO we're processing, but it's not clear if it's worth
      the replumbing to do that.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      092e1dc3
    • R
      tcm_qla2xxx: Don't insert nacls without sessions into the btree · 3578ddba
      Roland Dreier 提交于
      When we create an explicit node ACL in tcm_qla2xxx_make_nodeacl(),
      there is a call to tcm_qla2xxx_setup_nacl_from_rport(), which puts the
      node ACL into the lport_fcport_map even though there is no session yet
      for the initiator.  Since the only time we remove entries from this
      map is when we free a session, this means that if we later delete this
      node ACL without the initiator ever creating a session, we'll leave
      the nacl pointer in the btree pointing at freed memory.
      
      This is especially bad if that initiator later does send us a command
      that would cause us to create a dynamic ACL and session: we'll find
      the stale freed nacl pointer in the btree and end up with use-after-free.
      
      We could add more code to clear the btree entry when deleting the
      explicit nacl, but the original insertion is pointless: without a
      session attached, we'll just have to update the entry when a session
      appears anyway.  So we can just delete tcm_qla2xxx_setup_nacl_from_rport()
      and the code that calls it.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3578ddba
    • R
      target: Return error to initiator if SET TARGET PORT GROUPS emulation fails · 59e4f541
      Roland Dreier 提交于
      The error paths in target_emulate_set_target_port_groups() are all
      essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores
      rc and always returns success.  This means that even if eg explicit
      ALUA is turned off, the initiator will always see a good SCSI status
      for SET TARGET PORT GROUPS.
      
      Fix this by returning rc as is intended.  It appears this bug was
      added by the following patch:
      
      commit 05d1c7c0
      Author: Andy Grover <agrover@redhat.com>
      Date:   Wed Jul 20 19:13:28 2011 +0000
      
          target: Make all control CDBs scatter-gather
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      59e4f541
    • N
      tcm_qla2xxx: Clear session s_id + loop_id earlier during shutdown · f2d5d9b9
      Nicholas Bellinger 提交于
      This patch adds a new tcm_qla2xxx_clear_sess_lookup() call to clear session
      specific s_id + loop_id entries used for se_node_acl pointer lookup ahead
      of releasing se_session within the process context workqueue callback in
      tcm_qla2xxx_free_session().
      
      It makes the call in existing tcm_qla2xxx_clear_nacl_from_fcport_map()
      code invoked from qlt_unreg_sess() in interrupt context w/ hardware_lock
      held, ahead of the process context callback into qlt_free_session_done()
      -> tcm_qla2xxx_free_session().
      
      We are doing this to address a race between incoming ATIO or TMR packets
      using stale se_node_acl pointer once session shutdown has been invoked via
      qlt_unreg_sess() in qla_target.c LLD code, and when the entire tcm_qla2xxx
      endpoint has not been forced into shutdown w/ echo 0 > ../$QLA2XXX_PORT/enable
      
      Cc: Joern Engel <joern@logfs.org>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f2d5d9b9