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: <1352555839-18961-2-git-send-email-jiang.liu@huawei.com>
Date:	Sat, 10 Nov 2012 21:57:15 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Alex Williamson <alex.williamson@...hat.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Jiang Liu <jiang.liu@...wei.com>,
	Joerg Roedel <joerg.roedel@....com>,
	Yinghai Lu <yinghai@...nel.org>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, Hanjun Guo <guohanjun@...wei.com>
Subject: [RFC PATCH 2/6] iommu: pass on BUS_NOTIFY_QUERY_BINDING to iommu group notifier clients

 From: Jiang Liu <jiang.liu@...wei.com>

Pass on BUS_NOTIFY_QUERY_BINDING event to iommu group notifier clients,
so notifier clients have a chance to reject device driver binding.

Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
 drivers/iommu/iommu.c |   14 +++++++++-----
 include/linux/iommu.h |    1 +
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ddbdaca..7fbe055 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -497,6 +497,7 @@ static int add_iommu_group(struct device *dev, void *data)
 static int iommu_bus_notifier(struct notifier_block *nb,
 			      unsigned long action, void *data)
 {
+	int ret = NOTIFY_DONE;
 	struct device *dev = data;
 	struct iommu_ops *ops = dev->bus->iommu_ops;
 	struct iommu_group *group;
@@ -512,7 +513,7 @@ static int iommu_bus_notifier(struct notifier_block *nb,
 	} else if (action == BUS_NOTIFY_DEL_DEVICE) {
 		if (ops->remove_device && dev->iommu_group) {
 			ops->remove_device(dev);
-			return 0;
+			return NOTIFY_DONE;
 		}
 	}
 
@@ -522,9 +523,12 @@ static int iommu_bus_notifier(struct notifier_block *nb,
 	 */
 	group = iommu_group_get(dev);
 	if (!group)
-		return 0;
+		return NOTIFY_DONE;
 
 	switch (action) {
+	case BUS_NOTIFY_SOLICIT_BINDING:
+		group_action = IOMMU_GROUP_NOTIFY_SOLICIT_BINDING;
+		break;
 	case BUS_NOTIFY_BIND_DRIVER:
 		group_action = IOMMU_GROUP_NOTIFY_BIND_DRIVER;
 		break;
@@ -540,11 +544,11 @@ static int iommu_bus_notifier(struct notifier_block *nb,
 	}
 
 	if (group_action)
-		blocking_notifier_call_chain(&group->notifier,
-					     group_action, dev);
+		ret = blocking_notifier_call_chain(&group->notifier,
+						   group_action, dev);
 
 	iommu_group_put(group);
-	return 0;
+	return ret;
 }
 
 static struct notifier_block iommu_bus_nb = {
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7e83370..366435b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -109,6 +109,7 @@ struct iommu_ops {
 #define IOMMU_GROUP_NOTIFY_BOUND_DRIVER		4 /* Post Driver bind */
 #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER	5 /* Pre Driver unbind */
 #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER	6 /* Post Driver unbind */
+#define IOMMU_GROUP_NOTIFY_SOLICIT_BINDING	7 /* Check for objections */
 
 extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
 extern bool iommu_present(struct bus_type *bus);
-- 
1.7.9.5

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