Re: [PATCH] leds: lm3697: Fix out-of-bound access

ultracoolguy
2020-10-03T14:43:21Z

>I'll need your real name to apply a patch.

My real name is Gabriel David.

>Ok, so I assume this is only problem with certain device trees, and
not a problem with dts' in mainline?

Yes.
Here's the current node I'm using that causes this bug:

&i2c_5 {
status = "ok";

ti_lm3697@36 {
compatible = "ti,lm3697";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x36>;

led@1 {
reg = <1>;
led-sources = <0 1 2>;
ti,brightness-resolution = <2047>;
label = "white:backlight";
};
};
};

>This is not trivial patch, no need to cc trivial tree. OTOH Ccing
Marek who did a lot of cleanups in -next might be useful. Doing that
now.

Sorry for that. Gonna CC Marek from now on.

Btw thanks for the quick response!

Oct 3, 2020, 13:56 by pavel@ucw.cz:

> Hi!
>
>> Signed-off-by: Ultracoolguy <ultracoolguy@tutanota.com>
>>
>
> I'll need your real name to apply a patch.
>
>> Hi, all. This is a patch fixing an out-of-bounds error due to lm3697_init expecting the device tree to use both control banks.  This fixes it by adding a new variable that will hold the number of used banks.
>>
>> Panic caused by this bug:
>>
>> <7>[    3.059893] CPU: 3 PID: 1 Comm: swapper/0 Tainted: G        W         5.9.0-rc7-postmarketos-qcom-msm8953 #71
>>
>
> Ok, so I assume this is only problem with certain device trees, and
> not a problem with dts' in mainline?
>
> This is not trivial patch, no need to cc trivial tree. OTOH Ccing
> Marek who did a lot of cleanups in -next might be useful. Doing that
> now.
>
> Best regards,
>
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
>