lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 Aug 2022 16:02:43 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Brian Norris <briannorris@...omium.org>
Cc:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH] power: supply: core: Ignore -EIO for uevent

Hi,

On Wed, Aug 24, 2022 at 04:57:20PM -0700, Brian Norris wrote:
> For uevents, we enumerate all properties. Some battery implementations
> don't implement all standard properties, and may return -EIO for
> properties that aren't recognized. This means we never report uevents
> for such batteries.
> 
> It's better to ignore these errors and skip the property, as we do with
> ENODATA and ENODEV.
> 
> Example battery implementation: Acer Chromebook Tab 10 (a.k.a. Google
> Gru-Scarlet) has a virtual "SBS" battery implementation in its Embedded
> Controller on top of an otherwise non-SBS battery.
> 
> Signed-off-by: Brian Norris <briannorris@...omium.org>
> ---

-EIO means input/output error. If a driver is reporting that for an
unimplemented feature it's a bug that should be fixed in the driver.
Handling it here means userspace ABI changes for temporary issues.

-- Sebastian

>  drivers/power/supply/power_supply_sysfs.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index 4239591e1522..36fce572a213 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -439,10 +439,12 @@ static int add_prop_uevent(struct device *dev, struct kobj_uevent_env *env,
>  	dev_attr = &pwr_attr->dev_attr;
>  
>  	ret = power_supply_show_property(dev, dev_attr, prop_buf);
> -	if (ret == -ENODEV || ret == -ENODATA) {
> +	if (ret == -ENODEV || ret == -ENODATA || ret == -EIO) {
>  		/*
>  		 * When a battery is absent, we expect -ENODEV. Don't abort;
> -		 * send the uevent with at least the the PRESENT=0 property
> +		 * send the uevent with at least the PRESENT=0 property. Some
> +		 * batteries also report EIO, even for some standard
> +		 * properties.
>  		 */
>  		return 0;
>  	}
> -- 
> 2.37.2.672.g94769d06f0-goog
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ