xfs-masters
[Top] [All Lists]

[xfs-masters] [PATCH 3/3] Assert notifier_block and notifier_call are no

To: akpm@xxxxxxxx, torvalds@xxxxxxxx
Subject: [xfs-masters] [PATCH 3/3] Assert notifier_block and notifier_call are not in init section
From: sekharan@xxxxxxxxxx
Date: Mon, 24 Apr 2006 19:35:27 -0700
Cc: sekharan@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, herbert@xxxxxxxxxxxx, linux-xfs@xxxxxxxxxxx, xfs-masters@xxxxxxxxxxx, stern@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20060425023509.7529.84752.sendpatchset@xxxxxxxxxxxxxxxxxxxxx>
References: <20060425023509.7529.84752.sendpatchset@xxxxxxxxxxxxxxxxxxxxx>
Reply-to: xfs-masters@xxxxxxxxxxx
Sender: xfs-masters-bounce@xxxxxxxxxxx
Andrew,

        Feel free to drop this patch if you think it is not needed.

regards,

chandra
--

This patch ASSERTS that the notifier_block data structure and the
notifier_call funtion are not in the init section.

--
Signed-Off-By: Chandra Seetharaman <sekharan@xxxxxxxxxx>

 sys.c |    7 +++++++
 1 files changed, 7 insertions(+)

Index: linux-2617-rc2/kernel/sys.c
===================================================================
--- linux-2617-rc2.orig/kernel/sys.c    2006-04-24 11:29:30.000000000 -0700
+++ linux-2617-rc2/kernel/sys.c 2006-04-24 11:36:35.000000000 -0700
@@ -97,6 +97,11 @@ int cad_pid = 1;
 
 static BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
 
+static inline int addr_in_init_section(void *addr)
+{
+       return ((addr >= (void *)__init_begin) && (addr < (void *)__init_end));
+}
+
 /*
  *     Notifier chain core routines.  The exported routines below
  *     are layered on top of these, with appropriate locking added.
@@ -105,6 +110,8 @@ static BLOCKING_NOTIFIER_HEAD(reboot_not
 static int notifier_chain_register(struct notifier_block **nl,
                struct notifier_block *n)
 {
+       BUG_ON(addr_in_init_section(n)
+                || addr_in_init_section(n->notifier_call));
        while ((*nl) != NULL) {
                if (n->priority > (*nl)->priority)
                        break;

-- 

----------------------------------------------------------------------
    Chandra Seetharaman               | Be careful what you choose....
              - sekharan@xxxxxxxxxx   |      .......you may get it.
----------------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>