summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2005-01-24 20:49:07 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-24 20:49:07 -0800
commit5781864c26406a8a336e2f888f7d6b5abaebcbd6 (patch)
tree0be21778a600af4f541aa746655f77f1c1b2c61a /kernel
parent1ceabaa5be9552943497f98a114b66044f63d1a4 (diff)
[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: Greg Kroah-Hartman <greg@kroah.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/params.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/kernel/params.c b/kernel/params.c
index ec3dbf68e253..5538608bd339 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -640,9 +640,33 @@ static ssize_t module_attr_show(struct kobject *kobj,
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 = {
.show = module_attr_show,
- .store = NULL,
+ .store = module_attr_store,
};
#else