<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/params.c, branch v2.6.31.13</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel/params.c?h=v2.6.31.13</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel/params.c?h=v2.6.31.13'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2009-11-10T00:22:22Z</updated>
<entry>
<title>param: fix setting arrays of bool</title>
<updated>2009-11-10T00:22:22Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-10-29T14:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2367aa9bfd515bd76728b28d62a0fd00ef70832e'/>
<id>urn:sha1:2367aa9bfd515bd76728b28d62a0fd00ef70832e</id>
<content type='text'>
commit 3c7d76e371ac1a3802ae1673f5c63554af59325c upstream.

We create a dummy struct kernel_param on the stack for parsing each
array element, but we didn't initialize the flags word.  This matters
for arrays of type "bool", where the flag indicates if it really is
an array of bools or unsigned int (old-style).

Reported-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>param: fix NULL comparison on oom</title>
<updated>2009-11-10T00:22:18Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-10-29T14:56:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a8381266f673b5597f11fb9bad9ae196e9915f87'/>
<id>urn:sha1:a8381266f673b5597f11fb9bad9ae196e9915f87</id>
<content type='text'>
commit d553ad864e3b3dde3f1038d491e207021b2d6293 upstream.

kp-&gt;arg is always true: it's the contents of that pointer we care about.

Reported-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>param: fix lots of bugs with writing charp params from sysfs, by leaking mem.</title>
<updated>2009-11-10T00:22:17Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-10-29T14:56:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9f00eee2ffab59cb85ecf1de54282c7fb4669565'/>
<id>urn:sha1:9f00eee2ffab59cb85ecf1de54282c7fb4669565</id>
<content type='text'>
commit 65afac7d80ab3bc9f81e75eafb71eeb92a3ebdef upstream.

e180a6b7759a "param: fix charp parameters set via sysfs" fixed the case
where charp parameters written via sysfs were freed, leaving drivers
accessing random memory.

Unfortunately, storing a flag in the kparam struct was a bad idea: it's
rodata so setting it causes an oops on some archs.  But that's not all:

1) module_param_array() on charp doesn't work reliably, since we use an
   uninitialized temporary struct kernel_param.
2) there's a fundamental race if a module uses this parameter and then
   it's changed: they will still access the old, freed, memory.

The simplest fix (ie. for 2.6.32) is to never free the memory.  This
prevents all these problems, at cost of a memory leak.  In practice, there
are only 18 places where a charp is writable via sysfs, and all are
root-only writable.

Reported-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Cc: Sitsofe Wheeler &lt;sitsofe@yahoo.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Christof Schmitt &lt;christof.schmitt@de.ibm.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>module_param: allow 'bool' module_params to be bool, not just int.</title>
<updated>2009-06-12T12:16:58Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fddd520122953550ec2c8b60e7ca0d0f0d115d97'/>
<id>urn:sha1:fddd520122953550ec2c8b60e7ca0d0f0d115d97</id>
<content type='text'>
Impact: API cleanup

For historical reasons, 'bool' parameters must be an int, not a bool.
But there are around 600 users, so a conversion seems like useless churn.

So we use __same_type() to distinguish, and handle both cases.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>module_param: split perm field into flags and perm</title>
<updated>2009-06-12T12:16:56Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=45fcc70c0b6ee0c508e1fdb5fef735c3546803f4'/>
<id>urn:sha1:45fcc70c0b6ee0c508e1fdb5fef735c3546803f4</id>
<content type='text'>
Impact: cleanup

Rather than hack KPARAM_KMALLOCED into the perm field, separate it out.
Since the perm field was 32 bits and only needs 16, we don't add bloat.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>module_param: invbool should take a 'bool', not an 'int'</title>
<updated>2009-06-12T12:16:56Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9a71af2c3627b379b7c31917a7f6ee0d29bc559b'/>
<id>urn:sha1:9a71af2c3627b379b7c31917a7f6ee0d29bc559b</id>
<content type='text'>
It takes an 'int' for historical reasons, and there are only two
users: simply switch it over to bool.

The other user (uvesafb.c) will get a (harmless-on-x86) warning until
the next patch is applied.

Cc: Brad Douglas &lt;brad@neruo.com&gt;
Cc: Michal Januszewski &lt;spock@gentoo.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>param: fix charp parameters set via sysfs</title>
<updated>2009-03-31T02:35:30Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-03-31T19:05:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e180a6b7759a99a28cbcce3547c4c80822cb6c2a'/>
<id>urn:sha1:e180a6b7759a99a28cbcce3547c4c80822cb6c2a</id>
<content type='text'>
Impact: fix crash on reading from /sys/module/.../ieee80211_default_rc_algo

The module_param type "charp" simply sets a char * pointer in the
module to the parameter in the commandline string: this is why we keep
the (mangled) module command line around.  But when set via sysfs (as
about 11 charp parameters can be) this memory is freed on the way
out of the write().  Future reads hit random mem.

So we kstrdup instead: we have to check we're not in early commandline
parsing, and we have to note when we've used it so we can reliably
kfree the parameter when it's next overwritten, and also on module
unload.

(Thanks to Randy Dunlap for CONFIG_SYSFS=n fixes)

Reported-by: Sitsofe Wheeler &lt;sitsofe@yahoo.com&gt;
Diagnosed-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Tested-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Tested-by: Christof Schmitt &lt;christof.schmitt@de.ibm.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>Fix compile warning in kernel/params.c</title>
<updated>2008-10-23T19:09:00Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-10-23T19:07:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d2441183dc222d12961ff2201f5086c846505d93'/>
<id>urn:sha1:d2441183dc222d12961ff2201f5086c846505d93</id>
<content type='text'>
Move free_module_param_attrs() into the CONFIG_MODULES section, since
it's only used inside there. Thus avoiding the warning

  kernel/params.c:514: warning: 'free_module_param_attrs' defined but not used

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>core_param() for genuinely core kernel parameters</title>
<updated>2008-10-21T23:00:23Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2008-10-22T15:00:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=67e67ceaac5bf55dbdceb704ff2d763d438b5373'/>
<id>urn:sha1:67e67ceaac5bf55dbdceb704ff2d763d438b5373</id>
<content type='text'>
There are a lot of one-liner uses of __setup() in the kernel: they're
cumbersome and not queryable (definitely not settable) via /sys.  Yet
it's ugly to simplify them to module_param(), because by default that
inserts a prefix of the module name (usually filename).

So, introduce a "core_param".  The parameter gets no prefix, but
appears in /sys/module/kernel/parameters/ (if non-zero perms arg).  I
thought about using the name "core", but that's more common than
"kernel".  And if you create a module called "kernel", you will die
a horrible death.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>param: Fix duplicate module prefixes</title>
<updated>2008-10-21T23:00:23Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2008-10-22T15:00:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9b473de87209fa86eb421b23386693b461612f30'/>
<id>urn:sha1:9b473de87209fa86eb421b23386693b461612f30</id>
<content type='text'>
Instead of insisting each new module_param sysfs entry is unique,
handle the case where it already exists (for builtin modules).

The current code assumes that all identical prefixes are together in
the section: true for normal uses, but not necessarily so if someone
overrides MODULE_PARAM_PREFIX.  More importantly, it's not true with
the new "core_param()" code which uses "kernel" as a prefix.

This simplifies the caller for the builtin case, at a slight loss of
efficiency (we do the lookup every time to see if the directory
exists).

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
</feed>
