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]
Date:	Thu, 10 Dec 2009 21:07:38 +0800
From:	Xiaotian Feng <dfeng@...hat.com>
To:	tglx@...utronix.de, damm@...l.co.jp, hsweeten@...ionengravers.com,
	akpm@...ux-foundation.org, venkatesh.pallipadi@...el.com
Cc:	linux-kernel@...r.kernel.org, Xiaotian Feng <dfeng@...hat.com>
Subject: [PATCH 3/4] clockevents: add device to clockevent_devices list if notify ADD success

When we register new clock_event_device, CLOCK_EVT_NOTIFY_ADD was notified,
but tick_check_new_device may fail to use new device, we should only add
device to clockevent_devices list when tick_check_new_device success.

Signed-off-by: Xiaotian Feng <dfeng@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Magnus Damm <damm@...l.co.jp>
Cc: H Hartley Sweeten <hsweeten@...ionengravers.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>
---
 kernel/time/clockevents.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 980c2c0..69d6c58 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -164,11 +164,14 @@ static int clockevents_do_notify(unsigned long reason, void *dev)
 static void clockevents_notify_released(void)
 {
 	struct clock_event_device *dev, *tmp;
+	int ret;
 
 	list_for_each_entry_safe(dev, tmp, &clockevents_released, list) {
-		list_del(&dev->list);
-		list_add(&dev->list, &clockevent_devices);
-		clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+		ret = clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+		if (ret == NOTIFY_STOP) {
+			list_del(&dev->list);
+			list_add(&dev->list, &clockevent_devices);
+		}
 	}
 }
 
@@ -179,15 +182,19 @@ static void clockevents_notify_released(void)
 void clockevents_register_device(struct clock_event_device *dev)
 {
 	unsigned long flags;
+	int ret;
 
 	BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
 	BUG_ON(!dev->cpumask);
 
 	spin_lock_irqsave(&clockevents_lock, flags);
 
-	list_add(&dev->list, &clockevent_devices);
-	clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
-	clockevents_notify_released();
+	ret = clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
+	if (ret == NOTIFY_STOP) {
+		list_add(&dev->list, &clockevent_devices);
+		clockevents_notify_released();
+	} else
+		list_add(&dev->list, &clockevents_released);
 
 	spin_unlock_irqrestore(&clockevents_lock, flags);
 }
--
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