* [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
* Re: [PATCH] qla2xxx: Fix NULL pointer dereference
2012-02-17 20:39 [PATCH] qla2xxx: Fix NULL pointer dereference Jörn Engel
@ 2012-02-18 1:36 ` Roland Dreier
0 siblings, 0 replies; 2+ messages in thread
From: Roland Dreier @ 2012-02-18 1:36 UTC (permalink / raw)
To: Jörn Engel
Cc: Nicholas A. Bellinger, Andrew Vasquez, target-devel, linux-driver,
linux-scsi
On Fri, Feb 17, 2012 at 12:39 PM, Jörn Engel <joern@logfs.org> wrote:
> 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;
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)
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).