2008-03-21 22:48:19

by Chris Wright

[permalink] [raw]
Subject: [patch 28/76] SCSI gdth: dont call pci_free_consistent under spinlock

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: James Bottomley <[email protected]>

The spinlock is held over too large a region: pscratch is a permanent
address (it's allocated at boot time and never changes). All you need
the smp lock for is mediating the scratch in use flag, so fix this by
moving the spinlock into the case where we set the pscratch_busy flag
to false.

Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/scsi/gdth_proc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -694,15 +694,13 @@ static void gdth_ioctl_free(gdth_ha_str
{
ulong flags;

- spin_lock_irqsave(&ha->smp_lock, flags);
-
if (buf == ha->pscratch) {
+ spin_lock_irqsave(&ha->smp_lock, flags);
ha->scratch_busy = FALSE;
+ spin_unlock_irqrestore(&ha->smp_lock, flags);
} else {
pci_free_consistent(ha->pdev, size, buf, paddr);
}
-
- spin_unlock_irqrestore(&ha->smp_lock, flags);
}

#ifdef GDTH_IOCTL_PROC

--