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: <20210311061948.9348-1-lyl2019@mail.ustc.edu.cn>
Date:   Wed, 10 Mar 2021 22:19:48 -0800
From:   Lv Yunlong <lyl2019@...l.ustc.edu.cn>
To:     sathya.prakash@...adcom.com, sreekanth.reddy@...adcom.com,
        suganath-prabu.subramani@...adcom.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Subject: [PATCH] scsi: Fix a use after free in pcie_device_make_active

In pcie_device_make_active, it will drop the last reference
of pcie_device and release it by pcie_device_put(). It is
obviously that pcie_device_get() should be called before
release the pcie_device. Otherwise, it will cause a use after
free.

Fixes: d88e1eaba6eee ("scsi: mpt3sas: Add nvme device support in slave alloc, target alloc a…")
Signed-off-by: Lv Yunlong <lyl2019@...l.ustc.edu.cn>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index ffca03064797..d39b5a1f496b 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -11433,11 +11433,11 @@ static void pcie_device_make_active(struct MPT3SAS_ADAPTER *ioc,
 
 	spin_lock_irqsave(&ioc->pcie_device_lock, flags);
 
+	pcie_device_get(pcie_device);
 	if (!list_empty(&pcie_device->list)) {
 		list_del_init(&pcie_device->list);
 		pcie_device_put(pcie_device);
 	}
-	pcie_device_get(pcie_device);
 	list_add_tail(&pcie_device->list, &ioc->pcie_device_list);
 
 	spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ