Skip to content
Commit e180a6b7 authored by Rusty Russell's avatar Rusty Russell
Browse files

param: fix charp parameters set via sysfs



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: default avatarSitsofe Wheeler <sitsofe@yahoo.com>
Diagnosed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Tested-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Tested-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 15f7176e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment