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]
Message-ID: <cb3550f1-06c8-4e22-ae23-a738b61192fd@ysoft.com>
Date: Wed, 9 Oct 2024 11:56:31 +0200
From: Michal Vokáč <michal.vokac@...ft.com>
To: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>
Cc: Dan Murphy <dmurphy@...com>, Jacek Anaszewski
 <jacek.anaszewski@...il.com>, linux-leds@...r.kernel.org,
 linux-kernel@...r.kernel.org, stable@...r.kernel.org,
 Christian Marangi <ansuelsmth@...il.com>
Subject: Re: [PATCH] leds: lp55xx: Fix check for invalid channel number

+Cc Christian Marangi as I see he contributed a lot to this driver recently.

I also see that Dan Murphy can not be reached on the ti.com e-mail as he
works for Abbott since 2021 according to linkedin..

On 09. 10. 24 11:02, Michal Vokáč wrote:
> Prior to commit 92a81562e695 ("leds: lp55xx: Add multicolor framework
> support to lp55xx") the reg property (chan_nr) was parsed and stored
> as it was. Then, in lp55xx_init_led() function, it was checked if it
> is within valid range. In case it was not, an error message was
> printed and the driver probe failed.
> 
> With the mentioned commit the reg property is checked right after it
> is read from the device tree. Comparison to the upper range is not
> correct though. Valid reg values are 0 to (max_channel - 1). So in
> case the parsed value is out of this (wrong) range the probe just
> fails and no error message is shown.
> 
> Fix it by using proper comparison and print a message in case of
> an error. The check that is done in lp55xx_init_led() function is now
> redundant and can be removed.
> 
> Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx")
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Michal Vokáč <michal.vokac@...ft.com>
> ---
>   drivers/leds/leds-lp55xx-common.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
> index 5a2e259679cf..055ee77455f9 100644
> --- a/drivers/leds/leds-lp55xx-common.c
> +++ b/drivers/leds/leds-lp55xx-common.c
> @@ -512,12 +512,6 @@ static int lp55xx_init_led(struct lp55xx_led *led,
>   	led->max_current = pdata->led_config[chan].max_current;
>   	led->chan_nr = pdata->led_config[chan].chan_nr;
>   
> -	if (led->chan_nr >= max_channel) {
> -		dev_err(dev, "Use channel numbers between 0 and %d\n",
> -			max_channel - 1);
> -		return -EINVAL;
> -	}
> -
>   	if (pdata->led_config[chan].num_colors > 1)
>   		ret = devm_led_classdev_multicolor_register(dev, &led->mc_cdev);
>   	else
> @@ -1132,8 +1126,11 @@ static int lp55xx_parse_common_child(struct device_node *np,
>   	if (ret)
>   		return ret;
>   
> -	if (*chan_nr < 0 || *chan_nr > cfg->max_channel)
> +	if (*chan_nr < 0 || *chan_nr >= cfg->max_channel) {
> +		dev_err(dev, "Use channel numbers between 0 and %d\n",
> +			cfg->max_channel - 1);
>   		return -EINVAL;
> +	}
>   
>   	return 0;
>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ