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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a42c3826807abbeacc40.1153846595@rhun.haifa.ibm.com>
Date:	Tue, 25 Jul 2006 19:56:35 +0300
From:	Muli Ben-Yehuda <muli@...ibm.com>
To:	ak@...e.de
Cc:	jdmason@...ibm.com, linux-kernel@...r.kernel.org,
	discuss@...-64.org, muli@...ibm.com
Subject: [PATCH 5 of 7] [x86-64] Calgary IOMMU: fix reference counting of
	Calgary PCI devices

1 files changed, 6 insertions(+), 4 deletions(-)
arch/x86_64/kernel/pci-calgary.c |   10 ++++++----


# HG changeset patch
# User Muli Ben-Yehuda <muli@...ibm.com>
# Date 1153737943 -10800
# Node ID a42c3826807abbeacc40649127afb5103aabdbd4
# Parent  7b1cdbc92f2c618cb59feaf472c8b76df875743d
[x86-64] Calgary IOMMU: fix reference counting of Calgary PCI devices

The pci_get_device() API decrements the reference count on the 'from'
parameter when it continues searching. Therefore, take a ref count on
Calgary bus when we initialize them in either translated or
non-translated mode.

Signed-off-by: Muli Ben-Yehuda <muli@...ibm.com>
Signed-off-by: Jon Mason <jdmason@...ibm.com>

diff -r 7b1cdbc92f2c -r a42c3826807a arch/x86_64/kernel/pci-calgary.c
--- a/arch/x86_64/kernel/pci-calgary.c	Mon Jul 24 13:36:48 2006 +0300
+++ b/arch/x86_64/kernel/pci-calgary.c	Mon Jul 24 13:45:43 2006 +0300
@@ -786,6 +786,7 @@ static inline unsigned int __init locate
 
 static int __init calgary_init_one_nontraslated(struct pci_dev *dev)
 {
+	pci_dev_get(dev);
 	dev->sysdata = NULL;
 	dev->bus->self = dev;
 
@@ -810,6 +811,7 @@ static int __init calgary_init_one(struc
 	if (ret)
 		goto iounmap;
 
+	pci_dev_get(dev);
 	dev->bus->self = dev;
 	calgary_enable_translation(dev);
 
@@ -836,10 +838,9 @@ static int __init calgary_init(void)
 			calgary_init_one_nontraslated(dev);
 			continue;
 		}
-		if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) {
-			pci_dev_put(dev);
+		if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots)
 			continue;
-		}
+
 		ret = calgary_init_one(dev);
 		if (ret)
 			goto error;
@@ -860,9 +861,10 @@ error:
 		}
 		if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots)
 			continue;
+
 		calgary_disable_translation(dev);
 		calgary_free_bus(dev);
-		pci_dev_put(dev);
+		pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */
 	}
 
 	return ret;
-
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