[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1277206922-27259-1-git-send-email-jslaby@suse.cz>
Date: Tue, 22 Jun 2010 13:42:02 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: James.Bottomley@...e.de
Cc: linux-kernel@...r.kernel.org, jirislaby@...il.com,
Jiri Slaby <jslaby@...e.cz>, Srinivas <satyasrinivasp@....in>,
linux-scsi@...r.kernel.org
Subject: [PATCH] SCSI: mvsas, fix potential NULL dereference
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@...e.cz>
Cc: "James E.J. Bottomley" <James.Bottomley@...e.de>
Cc: Srinivas <satyasrinivasp@....in>
Cc: linux-scsi@...r.kernel.org
---
drivers/scsi/mvsas/mv_sas.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index f5e3217..cab9242 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -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;
@@ -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);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists