lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 26 Jul 2012 15:40:15 +0400
From:	Pavel Andrianov <andrianov@...ras.ru>
To:	Neela Syam Kolli <megaraidlinux@....com>
Cc:	Pavel Andrianov <andrianov@...ras.ru>,
	"James E.J. Bottomley" <JBottomley@...allels.com>,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	ldv-project@...ras.ru
Subject: [PATCH] scsi_megaraid: addition spin_lock in megaraid_abort()

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@...ras.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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ