[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <04127e71-4782-9bbb-fe5a-7c01e93a99b0@virtuozzo.com>
Date: Tue, 12 Mar 2019 11:06:32 +0300
From: Vasily Averin <vvs@...tuozzo.com>
To: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] notifiers: double register detection
By design notifiers can be registerd once only,
2nd register attempt called by mistake silently corrupts notifiers list.
Proposed check cannot prevent described problem,
however it allows to detect its reason quickly without coredump analyze.
Signed-off-by: Vasily Averin <vvs@...tuozzo.com>
---
kernel/notifier.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/notifier.c b/kernel/notifier.c
index 6196af8a8223..bfc95b3e4235 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -22,6 +22,7 @@ static int notifier_chain_register(struct notifier_block **nl,
struct notifier_block *n)
{
while ((*nl) != NULL) {
+ WARN_ONCE(((*nl) == n), "double register detected");
if (n->priority > (*nl)->priority)
break;
nl = &((*nl)->next);
--
2.17.1
Powered by blists - more mailing lists