All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_megaraid: addition spin_lock in megaraid_abort()
@ 2012-07-26 11:40 Pavel Andrianov
  0 siblings, 0 replies; only message in thread
From: Pavel Andrianov @ 2012-07-26 11:40 UTC (permalink / raw)
  To: Neela Syam Kolli
  Cc: Pavel Andrianov, James E.J. Bottomley, linux-scsi, linux-kernel,
	ldv-project

In function megaraid_abort() there are calls to megaraid_abort_and_reset()
and mega_rundoneq() which access shared data (like pending_list) without
synchronization.In function megaraid_reset() the same calls were done with
spin_lock held. So, the patch adds spin_lock_irq and spin_unlock_irq to
megaraid_abort().

Found by Linux Driver Verification project (linuxtesting.org)

Signed-off-by: Pavel Andrianov <andrianov@ispras.ru>
---
 drivers/scsi/megaraid.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 4d39a9f..7572d86 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1898,6 +1898,8 @@ megaraid_abort(Scsi_Cmnd *cmd)
 
 	adapter = (adapter_t *)cmd->device->host->hostdata;
 
+	spin_lock_irq(&adapter->lock);
+
 	rval =  megaraid_abort_and_reset(adapter, cmd, SCB_ABORT);
 
 	/*
@@ -1905,6 +1907,7 @@ megaraid_abort(Scsi_Cmnd *cmd)
 	 * to be communicated over to the mid layer.
 	 */
 	mega_rundoneq(adapter);
+	spin_unlock_irq(&adapter->lock);
 
 	return rval;
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-26 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-26 11:40 [PATCH] scsi_megaraid: addition spin_lock in megaraid_abort() Pavel Andrianov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.