[PATCH] qla2xxx: Fix NULL pointer dereference

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

 



Afaics the assignment does not need to be protected by ha->tgt_mutex and
we definitely should check for NULL before dereferencing sess.

Signed-off-by: Joern Engel <joern@xxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index ac203ef..4bbfa88 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2586,12 +2586,12 @@ static void qla_tgt_do_work(struct work_struct *work)
 
 		mutex_lock(&ha->tgt_mutex);
 		cmd->sess = sess = qla_tgt_make_local_sess(vha, s_id, loop_id);
-		cmd->loop_id = sess->loop_id;
 		/* sess has got an extra creation ref */
 		mutex_unlock(&ha->tgt_mutex);
 
 		if (!sess)
 			goto out_term;
+		cmd->loop_id = sess->loop_id;
 	}
 
 	if (tgt->tgt_stop)
-- 
1.7.8.3

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux