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] [day] [month] [year] [list]
Message-ID: 
 <CAGwozwFcLKRZv9_cGacJSEmOZ30CaQzS75_Vfb1DDWaNBXUvzg@mail.gmail.com>
Date: Fri, 2 May 2025 10:46:51 +0200
From: Antheas Kapenekakis <lkml@...heas.dev>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Derek John Clark <derekjohn.clark@...il.com>,
	Joaquín Ignacio Aramendía <samsagax@...il.com>,
	Hans de Goede <hdegoede@...hat.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
	Thomas Weißschuh <linux@...ssschuh.net>,
	platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] platform/x86: oxpec: Add a lower bounds check in
 oxp_psy_ext_set_prop()

On Fri, 2 May 2025 at 10:40, Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> The "val->intval" variable is an integer which comes from the user.  This
> code has an upper bounds check but the lower bounds check was
> accidentally omitted.  The write_to_ec() take a u8 value as a parameter
> so negative values would be truncated to positive values in the 0-255
> range.
>
> Return -EINVAL if the user passes a negative value.
>
> Fixes: 202593d1e86b ("platform/x86: oxpec: Add charge threshold and behaviour to OneXPlayer")

Reviewed-by: Antheas Kapenekakis <lkml@...heas.dev>

Thanks,
Antheas

> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  drivers/platform/x86/oxpec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/oxpec.c b/drivers/platform/x86/oxpec.c
> index 4b48f4571b09..de70ca7e8493 100644
> --- a/drivers/platform/x86/oxpec.c
> +++ b/drivers/platform/x86/oxpec.c
> @@ -582,7 +582,7 @@ static int oxp_psy_ext_set_prop(struct power_supply *psy,
>
>         switch (psp) {
>         case POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD:
> -               if (val->intval > 100)
> +               if (val->intval < 0 || val->intval > 100)
>                         return -EINVAL;
>                 return write_to_ec(OXP_X1_CHARGE_LIMIT_REG, val->intval);
>         case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
> --
> 2.47.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ