public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: torvalds@osdl.org, Andrew Morton <akpm@osdl.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	tj@home-tj.org, "Sergey S. Kostyliov" <rathamahata@ehouse.ru>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Modules: Allow sysfs module parameters to be written to.
Date: Tue, 25 Jan 2005 12:24:29 -0800	[thread overview]
Message-ID: <20050125202429.GA12084@kroah.com> (raw)
In-Reply-To: <1106463261.8118.13.camel@pegasus>

Linus, please apply this to your tree, it fixes the module parameter
stuff in sysfs so that it actually works.  Was verified by Marcel.

-----------

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>

diff -Nru a/kernel/params.c b/kernel/params.c
--- a/kernel/params.c	2005-01-24 21:07:40 -08:00
+++ b/kernel/params.c	2005-01-24 21:07:40 -08:00
@@ -640,9 +640,33 @@
 	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

      parent reply	other threads:[~2005-01-25 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 19:34 module's parameters could not be set via sysfs in 2.6.11-rc1? Sergey S. Kostyliov
2005-01-14  0:59 ` Greg KH
2005-01-23  6:54   ` Marcel Holtmann
2005-01-25  5:12     ` [PATCH] Modules: Allow sysfs module paramaters to be written to Greg KH
2005-01-25 13:15       ` Marcel Holtmann
2005-01-25 20:24     ` Greg KH [this message]

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=20050125202429.GA12084@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rathamahata@ehouse.ru \
    --cc=tj@home-tj.org \
    --cc=torvalds@osdl.org \
    /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