Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] qla2xxx: Fix NULL pointer dereference
@ 2012-02-17 20:39 Jörn Engel
  2012-02-18  1:36 ` Roland Dreier
  0 siblings, 1 reply; 2+ messages in thread
From: Jörn Engel @ 2012-02-17 20:39 UTC (permalink / raw)
  To: Nicholas A. Bellinger, Andrew Vasquez
  Cc: target-devel, linux-driver, linux-scsi, Roland Dreier

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@logfs.org>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-18  1:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17 20:39 [PATCH] qla2xxx: Fix NULL pointer dereference Jörn Engel
2012-02-18  1:36 ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox