linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* module's parameters could not be set via sysfs in 2.6.11-rc1?
@ 2005-01-13 19:34 Sergey S. Kostyliov
  2005-01-14  0:59 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Sergey S. Kostyliov @ 2005-01-13 19:34 UTC (permalink / raw)
  To: linux-kernel

Hello,

It looks like module parameters are not setable via sysfs in 2.6.11-rc1

E.g.
arise parameters # echo -en Y > /sys/module/usbcore/parameters/old_scheme_first
-bash: /sys/module/usbcore/parameters/old_scheme_first: Permission denied
arise parameters # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
arise parameters # 
arise parameters # ls -la /sys/module/usbcore/parameters/old_scheme_first
-rw-r--r--  1 root root 0 Jan 13 22:22 /sys/module/usbcore/parameters/old_scheme_first
arise parameters # 

This is sad because it seems that my usb flash stick (transcebd jetflash)
doesn't like new USB device initialization scheme introduced in 2.6.10.

-- 
Sergey S. Kostyliov <rathamahata@ehouse.ru>
Jabber ID: rathamahata@jabber.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: module's parameters could not be set via sysfs in 2.6.11-rc1?
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2005-01-14  0:59 UTC (permalink / raw)
  To: Sergey S. Kostyliov; +Cc: linux-kernel

On Thu, Jan 13, 2005 at 10:34:30PM +0300, Sergey S. Kostyliov wrote:
> Hello,
> 
> It looks like module parameters are not setable via sysfs in 2.6.11-rc1
> 
> E.g.
> arise parameters # echo -en Y > /sys/module/usbcore/parameters/old_scheme_first
> -bash: /sys/module/usbcore/parameters/old_scheme_first: Permission denied
> arise parameters # id
> uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
> arise parameters # 
> arise parameters # ls -la /sys/module/usbcore/parameters/old_scheme_first
> -rw-r--r--  1 root root 0 Jan 13 22:22 /sys/module/usbcore/parameters/old_scheme_first
> arise parameters # 
> 
> This is sad because it seems that my usb flash stick (transcebd jetflash)
> doesn't like new USB device initialization scheme introduced in 2.6.10.

I'm seeing the same problem here.  I'll dig into it later tonight.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: module's parameters could not be set via sysfs in 2.6.11-rc1?
  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 20:24     ` [PATCH] Modules: Allow sysfs module parameters " Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-01-23  6:54 UTC (permalink / raw)
  To: Greg KH; +Cc: Sergey S. Kostyliov, Linux Kernel Mailing List

Hi Greg,

> > It looks like module parameters are not setable via sysfs in 2.6.11-rc1
> > 
> > E.g.
> > arise parameters # echo -en Y > /sys/module/usbcore/parameters/old_scheme_first
> > -bash: /sys/module/usbcore/parameters/old_scheme_first: Permission denied
> > arise parameters # id
> > uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
> > arise parameters # 
> > arise parameters # ls -la /sys/module/usbcore/parameters/old_scheme_first
> > -rw-r--r--  1 root root 0 Jan 13 22:22 /sys/module/usbcore/parameters/old_scheme_first
> > arise parameters # 
> > 
> > This is sad because it seems that my usb flash stick (transcebd jetflash)
> > doesn't like new USB device initialization scheme introduced in 2.6.10.
> 
> I'm seeing the same problem here.  I'll dig into it later tonight.

any updates on this? It still results in a permission denied with a
recent 2.6.11-rc2 kernel.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Modules: Allow sysfs module paramaters to be written to.
  2005-01-23  6:54   ` Marcel Holtmann
@ 2005-01-25  5:12     ` Greg KH
  2005-01-25 13:15       ` Marcel Holtmann
  2005-01-25 20:24     ` [PATCH] Modules: Allow sysfs module parameters " Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2005-01-25  5:12 UTC (permalink / raw)
  To: Marcel Holtmann, tj; +Cc: Sergey S. Kostyliov, Linux Kernel Mailing List

On Sun, Jan 23, 2005 at 07:54:21AM +0100, Marcel Holtmann wrote:
> Hi Greg,
> 
> > > It looks like module parameters are not setable via sysfs in 2.6.11-rc1
> > > 
> > > E.g.
> > > arise parameters # echo -en Y > /sys/module/usbcore/parameters/old_scheme_first
> > > -bash: /sys/module/usbcore/parameters/old_scheme_first: Permission denied
> > > arise parameters # id
> > > uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
> > > arise parameters # 
> > > arise parameters # ls -la /sys/module/usbcore/parameters/old_scheme_first
> > > -rw-r--r--  1 root root 0 Jan 13 22:22 /sys/module/usbcore/parameters/old_scheme_first
> > > arise parameters # 
> > > 
> > > This is sad because it seems that my usb flash stick (transcebd jetflash)
> > > doesn't like new USB device initialization scheme introduced in 2.6.10.
> > 
> > I'm seeing the same problem here.  I'll dig into it later tonight.
> 
> any updates on this? It still results in a permission denied with a
> recent 2.6.11-rc2 kernel.

Here's a patch that fixes this for me.  It's as if the function was
never implemented at all for some reason.  Sorry for not catching this
when tj's patches went in that changed all of this logic.

Let me know if this fixes the problem for you or not.

thanks,

greg k-h

-----
Modules: Allow sysfs module paramaters to be written to.

Fixes a bug in the current tree preventing the sysfs module paramaters 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Modules: Allow sysfs module paramaters to be written to.
  2005-01-25  5:12     ` [PATCH] Modules: Allow sysfs module paramaters to be written to Greg KH
@ 2005-01-25 13:15       ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-01-25 13:15 UTC (permalink / raw)
  To: Greg KH; +Cc: tj, Sergey S. Kostyliov, Linux Kernel Mailing List

Hi Greg,

> Here's a patch that fixes this for me.  It's as if the function was
> never implemented at all for some reason.  Sorry for not catching this
> when tj's patches went in that changed all of this logic.
> 
> Let me know if this fixes the problem for you or not.

works fine for me. Please apply mainline as soon as possible.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Modules: Allow sysfs module parameters to be written to.
  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 20:24     ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-01-25 20:24 UTC (permalink / raw)
  To: torvalds, Andrew Morton
  Cc: Marcel Holtmann, tj, Sergey S. Kostyliov, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-25 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [PATCH] Modules: Allow sysfs module parameters " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).