public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: sekharan@us.ibm.com
To: akpm@osdl.org, torvalds@osdl.org
Cc: sekharan@us.ibm.com, linux-kernel@vger.kernel.org,
	herbert@13thfloor.at, linux-xfs@oss.sgi.com,
	xfs-masters@oss.sgi.com, stern@rowland.harvard.edu
Subject: [PATCH 3/3] Assert notifier_block and notifier_call are not in init section
Date: Mon, 24 Apr 2006 19:35:27 -0700	[thread overview]
Message-ID: <20060425023527.7529.9096.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060425023509.7529.84752.sendpatchset@localhost.localdomain>

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@us.ibm.com>

 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@us.ibm.com   |      .......you may get it.
----------------------------------------------------------------------

  parent reply	other threads:[~2006-04-25  2:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25  2:35 [PATCH 0/3] Fix for the bug reported by Herbert on 2.6.17-rc2 sekharan
2006-04-25  2:35 ` [PATCH 1/3] Remove __devinitdata from notifier block definitions sekharan
2006-04-25  2:35 ` [PATCH 2/3] Remove __devinit and __cpuinit from notifier_call definitions sekharan
2006-04-25  2:35 ` sekharan [this message]
2006-04-25  2:47   ` [PATCH 3/3] Assert notifier_block and notifier_call are not in init section Linus Torvalds
2006-04-25  2:50     ` Linus Torvalds
2006-04-25 19:01     ` Chandra Seetharaman
2006-04-25 19:16       ` Linus Torvalds
2006-04-25 20:26         ` Alan Stern
2006-04-25 20:38           ` Linus Torvalds
2006-04-25 20:54             ` Randy.Dunlap
2006-04-25 22:33         ` Chandra Seetharaman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060425023527.7529.9096.sendpatchset@localhost.localdomain \
    --to=sekharan@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@oss.sgi.com \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@osdl.org \
    --cc=xfs-masters@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox