[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+V4iMaZ7WzCWzSc@mail.local>
Date: Thu, 9 Feb 2023 23:49:44 +0100
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Samuel Holland <samuel@...lland.org>
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
linux-arm-kernel@...ts.infradead.org, linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH 1/2] rtc: sun6i: Prevent an out-of-bounds read
Hello,
What should I do with this series, I'm not sure you came to an
agreement.
Also, 2/2 doesn't apply so you'd have to rebase.
On 29/12/2022 12:40:10-0600, Samuel Holland wrote:
> If there is more than one parent clock in the devicetree, the
> driver sets .num_parents to a larger value than the number of array
> elements, which causes an out-of-bounds read in the clock framework.
>
> Fix this by coercing the parent count to a Boolean value, like the
> driver expects.
>
> Fixes: 3855c2c3e546 ("rtc: sun6i: Expose the 32kHz oscillator")
> Signed-off-by: Samuel Holland <samuel@...lland.org>
> ---
>
> drivers/rtc/rtc-sun6i.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
> index ed5516089e9a..a22358a44e32 100644
> --- a/drivers/rtc/rtc-sun6i.c
> +++ b/drivers/rtc/rtc-sun6i.c
> @@ -294,7 +294,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
>
> init.parent_names = parents;
> /* ... number of clock parents will be 1. */
> - init.num_parents = of_clk_get_parent_count(node) + 1;
> + init.num_parents = !!of_clk_get_parent_count(node) + 1;
> of_property_read_string_index(node, "clock-output-names", 0,
> &init.name);
>
> --
> 2.37.4
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists