aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_scsi_host.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@suse.de>2010-05-13 10:31:54 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-16 15:34:58 -0400
commit1b4d0d8ea7b3cbd107f345ab766416f9b38ce66a (patch)
treea5aeda206eb92e702ad7e9b9e2b91e50fa6964d2 /drivers/scsi/libsas/sas_scsi_host.c
parentb5dbc858717113c823fe6bb058807c2cb67d1efa (diff)
[SCSI] libsas: fix deref before check in commit 70b25f890ce
commit 70b25f890ce9f0520c64075ce9225a5b020a513e Author: Tejun Heo <tj@kernel.org> Date: Thu Apr 15 09:00:08 2010 +0900 [SCSI] fix locking around blk_abort_request() Introduced a reference before check problem, fix this by moving the lock shorthand code to be right at the point of actual use. Reported-by: Dan Carpenter <error27@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libsas/sas_scsi_host.c')
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 822835055ce..53849f21ad4 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1030,8 +1030,6 @@ int __sas_task_abort(struct sas_task *task)
1030void sas_task_abort(struct sas_task *task) 1030void sas_task_abort(struct sas_task *task)
1031{ 1031{
1032 struct scsi_cmnd *sc = task->uldd_task; 1032 struct scsi_cmnd *sc = task->uldd_task;
1033 struct request_queue *q = sc->device->request_queue;
1034 unsigned long flags;
1035 1033
1036 /* Escape for libsas internal commands */ 1034 /* Escape for libsas internal commands */
1037 if (!sc) { 1035 if (!sc) {
@@ -1043,13 +1041,15 @@ void sas_task_abort(struct sas_task *task)
1043 1041
1044 if (dev_is_sata(task->dev)) { 1042 if (dev_is_sata(task->dev)) {
1045 sas_ata_task_abort(task); 1043 sas_ata_task_abort(task);
1046 return; 1044 } else {
1047 } 1045 struct request_queue *q = sc->device->request_queue;
1046 unsigned long flags;
1048 1047
1049 spin_lock_irqsave(q->queue_lock, flags); 1048 spin_lock_irqsave(q->queue_lock, flags);
1050 blk_abort_request(sc->request); 1049 blk_abort_request(sc->request);
1051 spin_unlock_irqrestore(q->queue_lock, flags); 1050 spin_unlock_irqrestore(q->queue_lock, flags);
1052 scsi_schedule_eh(sc->device->host); 1051 scsi_schedule_eh(sc->device->host);
1052 }
1053} 1053}
1054 1054
1055int sas_slave_alloc(struct scsi_device *scsi_dev) 1055int sas_slave_alloc(struct scsi_device *scsi_dev)