From: Rusty Russell <rusty@rustcorp.com.au>
To: Takashi Iwai <tiwai@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Problems with string (charp) module parameters
Date: Wed, 21 Oct 2009 23:41:03 +1030 [thread overview]
Message-ID: <200910212341.06025.rusty@rustcorp.com.au> (raw)
In-Reply-To: <s5haazv1sw5.wl%tiwai@suse.de>
On Tue, 13 Oct 2009 09:07:46 pm Takashi Iwai wrote:
> While I tried to add some debug option to a driver, I found that a module
> parameter taking a string (charp) gives Oops when set via sysfs:
Hi Takashi,
Always nice to receive a good analysis like this: thanks!
> * Each struct kernel_param instance is defined as const, and is put
> into __param section, which is read-only.
> I guess this causes the page fault above. And...
Ah yes, that's bad, but we could fix that.
> * The above NULL check is invalid. It should be
> if (!*(char **)kp->arg)
> return -ENOMEM
> This is easy, however...
Good spotting.
> * The handling of parameter array is pretty buggy now.
> kp->perm and kp->flags aren't properly initialized in
> param_array(). Thus, you might call kfree() with invalid pointers,
> or pass a wrong type for bool.
Yes, an array of charp isn't going to work. Erk, I switched one bug for
another :(
> So, the situation looks messy right now, not only about the section
> issue. If we allow kmalloc of each parameter array element, the flag
> must be associated to each element, not a global one to the array.
>
> Thoughts?
Yes, that's hard. There's only one place which currently has a writable
array parameter: drivers/usb/atm/ueagle-atm.c, and it's root only.
OK, for 2.6.32, we remove the const. In the longer term, I'm reworking how
this is done entirely.
Thanks!
Rusty.
next prev parent reply other threads:[~2009-10-21 13:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-13 10:37 Problems with string (charp) module parameters Takashi Iwai
2009-10-21 13:11 ` Rusty Russell [this message]
2009-10-22 2:13 ` Takashi Iwai
2009-10-22 14:20 ` Rusty Russell
2009-10-22 15:54 ` Paul E. McKenney
2009-10-23 14:48 ` Rusty Russell
2009-10-21 15:28 ` [PATCH 1/2] param: don't make the kernel_param's const Rusty Russell
2009-10-21 15:45 ` [PATCH 2/2] param: initialize flags when processing array Rusty Russell
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=200910212341.06025.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
/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