linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission
@ 2017-04-22  2:19 Jérémy Lefaure
  2017-04-24  9:14 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jérémy Lefaure @ 2017-04-22  2:19 UTC (permalink / raw)
  To: Corentin Chary, Darren Hart, Andy Shevchenko
  Cc: acpi4asus-user, platform-driver-x86, linux-kernel,
	Jérémy Lefaure

The cpufv sysfs file is defined as readable by anyone even if the
attribute does not have a show function. The result of every read is an
IO error. This file should be write only.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
---
 drivers/platform/x86/asus-wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8499d3ae4257..0ace471cb700 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1761,7 +1761,7 @@ ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
 ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME);
 ASUS_WMI_CREATE_DEVICE_ATTR(als_enable, 0644, ASUS_WMI_DEVID_ALS_ENABLE);
 
-static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
+static ssize_t cpufv_store(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
 	int value, rv;
@@ -1778,7 +1778,7 @@ static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(cpufv, S_IRUGO | S_IWUSR, NULL, store_cpufv);
+static DEVICE_ATTR_WO(cpufv);
 
 static struct attribute *platform_attributes[] = {
 	&dev_attr_cpufv.attr,
-- 
2.12.2

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

* Re: [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission
  2017-04-22  2:19 [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission Jérémy Lefaure
@ 2017-04-24  9:14 ` Andy Shevchenko
  2017-04-24 15:31   ` Jérémy Lefaure
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-04-24  9:14 UTC (permalink / raw)
  To: Jérémy Lefaure
  Cc: Corentin Chary, Darren Hart, Andy Shevchenko, acpi4asus-user,
	Platform Driver, linux-kernel

On Sat, Apr 22, 2017 at 5:19 AM, Jérémy Lefaure
<jeremy.lefaure@lse.epita.fr> wrote:
> The cpufv sysfs file is defined as readable by anyone even if the
> attribute does not have a show function. The result of every read is an
> IO error. This file should be write only.

Per se patch looks good to me, though would be better to add show()
hook as well?

>
> Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
> ---
>  drivers/platform/x86/asus-wmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 8499d3ae4257..0ace471cb700 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -1761,7 +1761,7 @@ ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
>  ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME);
>  ASUS_WMI_CREATE_DEVICE_ATTR(als_enable, 0644, ASUS_WMI_DEVID_ALS_ENABLE);
>
> -static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
> +static ssize_t cpufv_store(struct device *dev, struct device_attribute *attr,
>                            const char *buf, size_t count)
>  {
>         int value, rv;
> @@ -1778,7 +1778,7 @@ static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
>         return count;
>  }
>
> -static DEVICE_ATTR(cpufv, S_IRUGO | S_IWUSR, NULL, store_cpufv);
> +static DEVICE_ATTR_WO(cpufv);
>
>  static struct attribute *platform_attributes[] = {
>         &dev_attr_cpufv.attr,
> --
> 2.12.2
>



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission
  2017-04-24  9:14 ` Andy Shevchenko
@ 2017-04-24 15:31   ` Jérémy Lefaure
  2017-04-25 12:27     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jérémy Lefaure @ 2017-04-24 15:31 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Corentin Chary, Darren Hart, Andy Shevchenko, acpi4asus-user,
	Platform Driver, linux-kernel

On Mon, 24 Apr 2017 12:14:14 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sat, Apr 22, 2017 at 5:19 AM, Jérémy Lefaure
> <jeremy.lefaure@lse.epita.fr> wrote:
> > The cpufv sysfs file is defined as readable by anyone even if the
> > attribute does not have a show function. The result of every read is an
> > IO error. This file should be write only.  
> 
> Per se patch looks good to me, though would be better to add show()
> hook as well?
> 
It depends if we want to keep it write-only as it is documented in
Documentation/ABI/testing/sysfs-platform-asus-wmi.

If we want to have this file read/write, I can send a v2 of this patch.

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

* Re: [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission
  2017-04-24 15:31   ` Jérémy Lefaure
@ 2017-04-25 12:27     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-04-25 12:27 UTC (permalink / raw)
  To: Jérémy Lefaure
  Cc: Corentin Chary, Darren Hart, Andy Shevchenko, acpi4asus-user,
	Platform Driver, linux-kernel

On Mon, Apr 24, 2017 at 6:31 PM, Jérémy Lefaure
<jeremy.lefaure@lse.epita.fr> wrote:
> On Mon, 24 Apr 2017 12:14:14 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
>> On Sat, Apr 22, 2017 at 5:19 AM, Jérémy Lefaure
>> <jeremy.lefaure@lse.epita.fr> wrote:
>> > The cpufv sysfs file is defined as readable by anyone even if the
>> > attribute does not have a show function. The result of every read is an
>> > IO error. This file should be write only.
>>
>> Per se patch looks good to me, though would be better to add show()
>> hook as well?
>>
> It depends if we want to keep it write-only as it is documented in
> Documentation/ABI/testing/sysfs-platform-asus-wmi.
>
> If we want to have this file read/write, I can send a v2 of this patch.

I dunno we need.
So, since no answer from anyone I pushed this to testing, thanks!

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2017-04-25 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-22  2:19 [PATCH] platform/x86: asus-wmi: fix cpufv sysfs file permission Jérémy Lefaure
2017-04-24  9:14 ` Andy Shevchenko
2017-04-24 15:31   ` Jérémy Lefaure
2017-04-25 12:27     ` Andy Shevchenko

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