linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi/ec: Deny write access unless requested by module param
@ 2016-02-06  7:08 green
  2016-02-17 14:27 ` Thomas Renninger
  2016-03-10 23:32 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: green @ 2016-02-06  7:08 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Thomas Renninger
  Cc: linux-acpi, linux-kernel, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

In debugfs it's not enough to just set file mode to read-only to
deny write access to a file, instead just don't provide
the write method unless write access is really requested.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
I assume allowing run-time changes via /sys/module is preferrable,
opposed to forced module unload and reload to change this option,
but I can submit another patch to only depend on the module parameter
too, please let me know.

 drivers/acpi/ec_sys.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index bea8e42..6c7dd7a 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -73,6 +73,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
 	loff_t init_off = *off;
 	int err = 0;
 
+	if (!write_support)
+		return -EINVAL;
+
 	if (*off >= EC_SPACE_SIZE)
 		return 0;
 	if (*off + count >= EC_SPACE_SIZE) {
-- 
2.1.0

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

* Re: [PATCH] acpi/ec: Deny write access unless requested by module param
  2016-02-06  7:08 [PATCH] acpi/ec: Deny write access unless requested by module param green
@ 2016-02-17 14:27 ` Thomas Renninger
  2016-03-10 23:32 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Renninger @ 2016-02-17 14:27 UTC (permalink / raw)
  To: green; +Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel

On Saturday, February 06, 2016 02:08:08 AM green@linuxhacker.ru wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
> 
> In debugfs it's not enough to just set file mode to read-only to
> deny write access to a file, instead just don't provide
> the write method unless write access is really requested.
> 
> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Thomas Renninger <trenn@suse.com>

Thanks!

> ---
> I assume allowing run-time changes via /sys/module is preferrable,
> opposed to forced module unload and reload to change this option,
> but I can submit another patch to only depend on the module parameter
> too, please let me know.
> 
>  drivers/acpi/ec_sys.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
> index bea8e42..6c7dd7a 100644
> --- a/drivers/acpi/ec_sys.c
> +++ b/drivers/acpi/ec_sys.c
> @@ -73,6 +73,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char
> __user *buf, loff_t init_off = *off;
>  	int err = 0;
> 
> +	if (!write_support)
> +		return -EINVAL;
> +
>  	if (*off >= EC_SPACE_SIZE)
>  		return 0;
>  	if (*off + count >= EC_SPACE_SIZE) {

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

* Re: [PATCH] acpi/ec: Deny write access unless requested by module param
  2016-02-06  7:08 [PATCH] acpi/ec: Deny write access unless requested by module param green
  2016-02-17 14:27 ` Thomas Renninger
@ 2016-03-10 23:32 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2016-03-10 23:32 UTC (permalink / raw)
  To: green; +Cc: Len Brown, Thomas Renninger, linux-acpi, linux-kernel

On Saturday, February 06, 2016 02:08:08 AM green@linuxhacker.ru wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
> 
> In debugfs it's not enough to just set file mode to read-only to
> deny write access to a file, instead just don't provide
> the write method unless write access is really requested.
> 
> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
> ---
> I assume allowing run-time changes via /sys/module is preferrable,
> opposed to forced module unload and reload to change this option,
> but I can submit another patch to only depend on the module parameter
> too, please let me know.
> 
>  drivers/acpi/ec_sys.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
> index bea8e42..6c7dd7a 100644
> --- a/drivers/acpi/ec_sys.c
> +++ b/drivers/acpi/ec_sys.c
> @@ -73,6 +73,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
>  	loff_t init_off = *off;
>  	int err = 0;
>  
> +	if (!write_support)
> +		return -EINVAL;
> +
>  	if (*off >= EC_SPACE_SIZE)
>  		return 0;
>  	if (*off + count >= EC_SPACE_SIZE) {
> 

Applied, thanks!

Rafael

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

end of thread, other threads:[~2016-03-10 23:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-06  7:08 [PATCH] acpi/ec: Deny write access unless requested by module param green
2016-02-17 14:27 ` Thomas Renninger
2016-03-10 23:32 ` Rafael J. Wysocki

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).