public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi_msghandler module load failure
@ 2004-07-16 16:34 Khalid Aziz
  2004-07-17  2:09 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Khalid Aziz @ 2004-07-16 16:34 UTC (permalink / raw)
  To: Corey Minyard; +Cc: LKML

Corey,

On a 2.6.7 kernel, when I try to modprobe ipmi_msghandler, it fails to
load with following message:

FATAL: Error inserting ipmi_msghandler (/lib/modules/2.6.7/kernel/drivers/char/ipmi/ipmi_msghandler.ko): Invalid module format

And there is an error message in dmesg:

ipmi_msghandler: init symbol 0xa000000200058080 used in module code at a000000200031b32

What I have been able to determine is that ipmi_msghandler.c defines
ipmi_init_msghandler() as the module_init() routine and then it also
calls ipmi_init_msghandler() diretcly from couple of other places. This
does not seem to be okay in 2.6.7 kernel. I was able to fix this by
defining a new module_init routine which in turn calls
ipmi_init_msghandler(). I also removed __init from
ipmi_init_msghandler() since it gets called from ipmi_open() on an open
of the ipmi device file. So I would think we want to keep
ipmi_init_msghandler() around even after initialization. Here is the
patch. Please apply if it looks good:

--- linux-2.6.7/drivers/char/ipmi/ipmi_msghandler.c	2004-06-15 23:19:36.000000000 -0600
+++ linux-2.6.7.new/drivers/char/ipmi/ipmi_msghandler.c	2004-07-16 10:28:52.000000000 -0600
@@ -3072,7 +3072,7 @@
 	200   /* priority: INT_MAX >= x >= 0 */
 };
 
-static __init int ipmi_init_msghandler(void)
+static int ipmi_init_msghandler(void)
 {
 	int i;
 
@@ -3107,6 +3107,11 @@
 	return 0;
 }
 
+static __init int ipmi_init_msghandler_mod(void)
+{
+	ipmi_init_msghandler();
+}
+
 static __exit void cleanup_ipmi(void)
 {
 	int count;
@@ -3143,7 +3148,7 @@
 }
 module_exit(cleanup_ipmi);
 
-module_init(ipmi_init_msghandler);
+module_init(ipmi_init_msghandler_mod);
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(ipmi_alloc_recv_msg);

-- 
Khalid

====================================================================
Khalid Aziz                                Linux and Open Source Lab
(970)898-9214                                        Hewlett-Packard
khalid_aziz@hp.com                                  Fort Collins, CO

"The Linux kernel is subject to relentless development" 
				- Alessandro Rubini



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipmi_msghandler module load failure
  2004-07-16 16:34 [PATCH] ipmi_msghandler module load failure Khalid Aziz
@ 2004-07-17  2:09 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2004-07-17  2:09 UTC (permalink / raw)
  To: Khalid Aziz; +Cc: LKML

So they've added enforcement so that non-init code cannot call init 
code.  The call as it was is actually safe, there is a variable that 
will  only cause it to be called if it has not been called yet (there 
are possible reasons to do this when the driver is compiled into the 
kernel) and it always gets called at init time. The the enforcement is 
probably a good thing, though.  The patch looks ok.

-Corey

Khalid Aziz wrote:

>Corey,
>
>On a 2.6.7 kernel, when I try to modprobe ipmi_msghandler, it fails to
>load with following message:
>
>FATAL: Error inserting ipmi_msghandler (/lib/modules/2.6.7/kernel/drivers/char/ipmi/ipmi_msghandler.ko): Invalid module format
>
>And there is an error message in dmesg:
>
>ipmi_msghandler: init symbol 0xa000000200058080 used in module code at a000000200031b32
>
>What I have been able to determine is that ipmi_msghandler.c defines
>ipmi_init_msghandler() as the module_init() routine and then it also
>calls ipmi_init_msghandler() diretcly from couple of other places. This
>does not seem to be okay in 2.6.7 kernel. I was able to fix this by
>defining a new module_init routine which in turn calls
>ipmi_init_msghandler(). I also removed __init from
>ipmi_init_msghandler() since it gets called from ipmi_open() on an open
>of the ipmi device file. So I would think we want to keep
>ipmi_init_msghandler() around even after initialization. Here is the
>patch. Please apply if it looks good:
>
>--- linux-2.6.7/drivers/char/ipmi/ipmi_msghandler.c	2004-06-15 23:19:36.000000000 -0600
>+++ linux-2.6.7.new/drivers/char/ipmi/ipmi_msghandler.c	2004-07-16 10:28:52.000000000 -0600
>@@ -3072,7 +3072,7 @@
> 	200   /* priority: INT_MAX >= x >= 0 */
> };
> 
>-static __init int ipmi_init_msghandler(void)
>+static int ipmi_init_msghandler(void)
> {
> 	int i;
> 
>@@ -3107,6 +3107,11 @@
> 	return 0;
> }
> 
>+static __init int ipmi_init_msghandler_mod(void)
>+{
>+	ipmi_init_msghandler();
>+}
>+
> static __exit void cleanup_ipmi(void)
> {
> 	int count;
>@@ -3143,7 +3148,7 @@
> }
> module_exit(cleanup_ipmi);
> 
>-module_init(ipmi_init_msghandler);
>+module_init(ipmi_init_msghandler_mod);
> MODULE_LICENSE("GPL");
> 
> EXPORT_SYMBOL(ipmi_alloc_recv_msg);
>
>  
>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-17  2:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-16 16:34 [PATCH] ipmi_msghandler module load failure Khalid Aziz
2004-07-17  2:09 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox