public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Command line parameter not passed to module in linux-next
@ 2009-02-27 17:01 Christof Schmitt
  2009-03-02  0:45 ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Christof Schmitt @ 2009-02-27 17:01 UTC (permalink / raw)
  To: linux-kernel, rusty

The linux-next kernel does not pass charp parameters from the kernel
command line to modules:

# cat /proc/cmdline 
dasd=4d70-4d73 root=/dev/dasdc1 zfcp.device=0.0.181d,0x500507630310c562,0x401040C300000000 zfcp.dbfsize=4096  BOOT_IMAGE=0 

# cat /sys/module/zfcp/parameters/device 
<NULL>

It seems that this patches introduces the problem:
	commit 9f229de63cf02297c0e0fbaa8d74b962cceff435
	Author: Rusty Russell <rusty@rustcorp.com.au>
	Date:   Fri Feb 20 10:31:19 2009 +1100

	    param:fix-charp-sysfs-write

Reverting the patch on linux-next fixes the problem:

# cat /sys/module/zfcp/parameters/device 
0.0.181d,0x500507630310c562,0x401040C300000000

--
Christof Schmitt

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

* Re: Command line parameter not passed to module in linux-next
  2009-02-27 17:01 Command line parameter not passed to module in linux-next Christof Schmitt
@ 2009-03-02  0:45 ` Rusty Russell
  2009-03-02  8:38   ` Christof Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2009-03-02  0:45 UTC (permalink / raw)
  To: Christof Schmitt; +Cc: linux-kernel

On Saturday 28 February 2009 03:31:05 Christof Schmitt wrote:
> The linux-next kernel does not pass charp parameters from the kernel
> command line to modules:
> 
> # cat /proc/cmdline 
> dasd=4d70-4d73 root=/dev/dasdc1 zfcp.device=0.0.181d,0x500507630310c562,0x401040C300000000 zfcp.dbfsize=4096  BOOT_IMAGE=0 
> 
> # cat /sys/module/zfcp/parameters/device 
> <NULL>

Thanks:

param: fix charp parameters set via sysfs: FIX

We can't kmalloc at early cmdline parsing.

Reported-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/kernel/params.c b/kernel/params.c
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -223,10 +223,16 @@ int param_set_charp(const char *val, str
 	if (kp->perm & KPARAM_KMALLOCED)
 		kfree(*(char **)kp->arg);
 
-	kp->perm |= KPARAM_KMALLOCED;
-	*(char **)kp->arg = kstrdup(val, GFP_KERNEL);
-	if (!kp->arg)
-		return -ENOMEM;
+	/* This is a hack.  We can't need to strdup in early boot, and we
+	 * don't need to; this mangled commandline is preserved. */
+	if (slab_is_available()) {
+		kp->perm |= KPARAM_KMALLOCED;
+		*(char **)kp->arg = kstrdup(val, GFP_KERNEL);
+		if (!kp->arg)
+			return -ENOMEM;
+	} else
+		*(const char **)kp->arg = val;
+
 	return 0;
 }
 

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

* Re: Command line parameter not passed to module in linux-next
  2009-03-02  0:45 ` Rusty Russell
@ 2009-03-02  8:38   ` Christof Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Christof Schmitt @ 2009-03-02  8:38 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

Rusty Russell <rusty@rustcorp.com.au> wrote on 03/02/2009 01:45:23 AM:

> On Saturday 28 February 2009 03:31:05 Christof Schmitt wrote:
> > The linux-next kernel does not pass charp parameters from the kernel
> > command line to modules:
> > 
> > # cat /proc/cmdline 
> > dasd=4d70-4d73 root=/dev/dasdc1 zfcp.device=0.0.181d,
> 0x500507630310c562,0x401040C300000000 zfcp.dbfsize=4096  BOOT_IMAGE=0 
> > 
> > # cat /sys/module/zfcp/parameters/device 
> > <NULL>
> 
> Thanks:
> 
> param: fix charp parameters set via sysfs: FIX
> 
> We can't kmalloc at early cmdline parsing.
> 
> Reported-by: Christof Schmitt <christof.schmitt@de.ibm.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> 
> diff --git a/kernel/params.c b/kernel/params.c
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -223,10 +223,16 @@ int param_set_charp(const char *val, str
>     if (kp->perm & KPARAM_KMALLOCED)
>        kfree(*(char **)kp->arg);
> 
> -   kp->perm |= KPARAM_KMALLOCED;
> -   *(char **)kp->arg = kstrdup(val, GFP_KERNEL);
> -   if (!kp->arg)
> -      return -ENOMEM;
> +   /* This is a hack.  We can't need to strdup in early boot, and we
> +    * don't need to; this mangled commandline is preserved. */
> +   if (slab_is_available()) {
> +      kp->perm |= KPARAM_KMALLOCED;
> +      *(char **)kp->arg = kstrdup(val, GFP_KERNEL);
> +      if (!kp->arg)
> +         return -ENOMEM;
> +   } else
> +      *(const char **)kp->arg = val;
> +
>     return 0;
>  }

Thanks, the patch works for me.
Tested-by: Christof Schmitt <christof.schmitt@de.ibm.com>

--
Christof Schmitt

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

end of thread, other threads:[~2009-03-02  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 17:01 Command line parameter not passed to module in linux-next Christof Schmitt
2009-03-02  0:45 ` Rusty Russell
2009-03-02  8:38   ` Christof Schmitt

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