Commit 5781864c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] Modules: Allow sysfs module parameters to be written to.

This fixes a bug in the current tree preventing the sysfs module
parameters from being able to be changed at all from userspace.  It's as
if someone just forgot to write this function...
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ceabaa5
...@@ -640,9 +640,33 @@ static ssize_t module_attr_show(struct kobject *kobj, ...@@ -640,9 +640,33 @@ static ssize_t module_attr_show(struct kobject *kobj,
return ret; return ret;
} }
static ssize_t module_attr_store(struct kobject *kobj,
struct attribute *attr,
const char *buf, size_t len)
{
struct module_attribute *attribute;
struct module_kobject *mk;
int ret;
attribute = to_module_attr(attr);
mk = to_module_kobject(kobj);
if (!attribute->store)
return -EPERM;
if (!try_module_get(mk->mod))
return -ENODEV;
ret = attribute->store(attribute, mk->mod, buf, len);
module_put(mk->mod);
return ret;
}
static struct sysfs_ops module_sysfs_ops = { static struct sysfs_ops module_sysfs_ops = {
.show = module_attr_show, .show = module_attr_show,
.store = NULL, .store = module_attr_store,
}; };
#else #else
......
Markdown is supported
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