qla2xxx: Fix NULL pointer dereference
Subsystems (2)
PATCH 1/1 qla2xxx: Fix NULL pointer dereference
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 <[email protected]>
--- drivers/scsi/qla2xxx/qla_target.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +1 -1
@@ -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)
Signature · 1 line
1.7.8.3
Quoted 13 lines · Jörn Engel
Afaics the assignment does not need to be protected by
ha->tgt_mutexand we definitely should check for NULL before dereferencing sess.Signed-off-by Joern Engel <[email protected]>---
drivers/scsi/qla2xxx/qla_target.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/scsi/qla2xxx/qla_target.c +0
-0
drivers/scsi/qla2xxx/qla_target.c static void qla_tgt_do_work(struct work_struct *work) · line 2594
Quoted 10 lines
drivers/scsi/qla2xxx/qla_target.c +1
-1@@ -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;
Good catch... maybe it's cleaner if we just use the loop_id local variable we already have anyway? (Not that it really matters either way)