Skip to content

Commit

Permalink
[SCSI] mvsas: fix potential NULL dereference
Browse files Browse the repository at this point in the history
Stanse found that in mvs_abort_task, mvi_dev is dereferenced earlier
than tested for being NULL. Move the assignment below the test.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Jiri Slaby authored and James Bottomley committed Jul 27, 2010
1 parent 97009a2 commit 24ae163
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/scsi/mvsas/mv_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ int mvs_abort_task(struct sas_task *task)
struct mvs_tmf_task tmf_task;
struct domain_device *dev = task->dev;
struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
struct mvs_info *mvi;
int rc = TMF_RESP_FUNC_FAILED;
unsigned long flags;
u32 tag;
Expand All @@ -1650,6 +1650,8 @@ int mvs_abort_task(struct sas_task *task)
rc = TMF_RESP_FUNC_FAILED;
}

mvi = mvi_dev->mvi_info;

spin_lock_irqsave(&task->task_state_lock, flags);
if (task->task_state_flags & SAS_TASK_STATE_DONE) {
spin_unlock_irqrestore(&task->task_state_lock, flags);
Expand Down

0 comments on commit 24ae163

Please sign in to comment.