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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200421210822.18994-1-wu000273@umn.edu>
Date:   Tue, 21 Apr 2020 16:08:22 -0500
From:   wu000273@....edu
To:     jejb@...ux.ibm.com
Cc:     QLogic-Storage-Upstream@...gic.com, martin.petersen@...cle.com,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        kjlu@....edu, wu000273@....edu
Subject: [PATCH] scsi: qla4xxx: Fix a potential race condition.

From: Qiushi Wu <wu000273@....edu>

In the function qla4xxx_eh_abort, we should use lock protect both
kref_get() and kref_put(), because we must serialize access where a
kref_put() cannot occur during the kref_get(). Otherwise, the object
"srb" may not remain valid during the kref_get(), and a race condition
can happen.

Signed-off-by: Qiushi Wu <wu000273@....edu>
---
 drivers/scsi/qla4xxx/ql4_os.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 5504ab11decc..a1400cadb91a 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -9222,8 +9222,10 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
 		    ha->host_no, id, lun));
 		wait = 1;
 	}
-
+
+	spin_lock_irqsave(&ha->hardware_lock, flags);
 	kref_put(&srb->srb_ref, qla4xxx_srb_compl);
+	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
 	/* Wait for command to complete */
 	if (wait) {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ