diff mbox series

ACPI / EC: Mark the ec_sys write_support param as module_param_hw()

Message ID 20211125103616.47742-1-hdegoede@redhat.com (mailing list archive)
State Mainlined, archived
Headers show
Series ACPI / EC: Mark the ec_sys write_support param as module_param_hw() | expand

Commit Message

Hans de Goede Nov. 25, 2021, 10:36 a.m. UTC
Using write_support=1 with the ec_sys module changes the mode of the
"io" debugfs file to 0600. This will cause any attempts to access it under
a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys
module unusable.

Use the special module_param_hw() macro for module parameters which
may not be used while in lockdown mode, to avoid this.

Cc: Mark Pearson <markpearson@lenovo.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/ec_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Pearson Dec. 1, 2021, 2:06 p.m. UTC | #1
On 2021-11-25 05:36, Hans de Goede wrote:
> Using write_support=1 with the ec_sys module changes the mode of the
> "io" debugfs file to 0600. This will cause any attempts to access it under
> a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys
> module unusable.
> 
> Use the special module_param_hw() macro for module parameters which
> may not be used while in lockdown mode, to avoid this.
> 
> Cc: Mark Pearson <markpearson@lenovo.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/acpi/ec_sys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
> index fd39c14493ab..c074a0fae059 100644
> --- a/drivers/acpi/ec_sys.c
> +++ b/drivers/acpi/ec_sys.c
> @@ -19,7 +19,7 @@ MODULE_DESCRIPTION("ACPI EC sysfs access driver");
>  MODULE_LICENSE("GPL");
>  
>  static bool write_support;
> -module_param(write_support, bool, 0644);
> +module_param_hw(write_support, bool, other, 0644);
>  MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
>  		 "be needed.");
>  
> 
Looks good to me. Thanks Hans
Mark
Rafael J. Wysocki Dec. 1, 2021, 7:21 p.m. UTC | #2
On Wed, Dec 1, 2021 at 3:06 PM Mark Pearson <markpearson@lenovo.com> wrote:
>
>
> On 2021-11-25 05:36, Hans de Goede wrote:
> > Using write_support=1 with the ec_sys module changes the mode of the
> > "io" debugfs file to 0600. This will cause any attempts to access it under
> > a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys
> > module unusable.
> >
> > Use the special module_param_hw() macro for module parameters which
> > may not be used while in lockdown mode, to avoid this.
> >
> > Cc: Mark Pearson <markpearson@lenovo.com>
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > ---
> >  drivers/acpi/ec_sys.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
> > index fd39c14493ab..c074a0fae059 100644
> > --- a/drivers/acpi/ec_sys.c
> > +++ b/drivers/acpi/ec_sys.c
> > @@ -19,7 +19,7 @@ MODULE_DESCRIPTION("ACPI EC sysfs access driver");
> >  MODULE_LICENSE("GPL");
> >
> >  static bool write_support;
> > -module_param(write_support, bool, 0644);
> > +module_param_hw(write_support, bool, other, 0644);
> >  MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
> >                "be needed.");
> >
> >
> Looks good to me. Thanks Hans
> Mark

Patch applied as 5.17 material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index fd39c14493ab..c074a0fae059 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -19,7 +19,7 @@  MODULE_DESCRIPTION("ACPI EC sysfs access driver");
 MODULE_LICENSE("GPL");
 
 static bool write_support;
-module_param(write_support, bool, 0644);
+module_param_hw(write_support, bool, other, 0644);
 MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
 		 "be needed.");