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  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]
Date:   Thu, 07 Feb 2019 16:30:31 -0800
From:   Kevin Hilman <khilman@...libre.com>
To:     Maxime Jourdan <mjourdan@...libre.com>,
        Neil Armstrong <narmstrong@...libre.com>
Cc:     linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] soc: amlogic: canvas: Fix meson_canvas_get when probe failed

Maxime Jourdan <mjourdan@...libre.com> writes:

> On Mon, Feb 4, 2019 at 10:49 AM Neil Armstrong <narmstrong@...libre.com> wrote:
>>
>> When probe fails, a platforn_device is still associated to the node,
>> but dev_get_drvdata() returns NULL.
>>
>> Handle this case by returning a consistent error.
>>
>> Fixes: d4983983d987 ("soc: amlogic: add meson-canvas driver")
>> Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
>> ---
>>  drivers/soc/amlogic/meson-canvas.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> This fix depends on "soc: amlogic: add missing of_node_put()" at [1]
>>
>> [1] https://patchwork.kernel.org/patch/10794545/
>>
>> diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
>> index 87a6c6e23591..151aa84bc593 100644
>> --- a/drivers/soc/amlogic/meson-canvas.c
>> +++ b/drivers/soc/amlogic/meson-canvas.c
>> @@ -51,6 +51,7 @@ struct meson_canvas *meson_canvas_get(struct device *dev)
>>  {
>>         struct device_node *canvas_node;
>>         struct platform_device *canvas_pdev;
>> +       struct meson_canvas *canvas;
>>
>>         canvas_node = of_parse_phandle(dev->of_node, "amlogic,canvas", 0);
>>         if (!canvas_node)
>> @@ -63,7 +64,17 @@ struct meson_canvas *meson_canvas_get(struct device *dev)
>>         }
>>
>>         of_node_put(canvas_node);
>> -       return dev_get_drvdata(&canvas_pdev->dev);
>> +
>> +       /*
>> +        * If priv is NULL, it's probably because the canvas hasn't
>> +        * properly initialized. Bait out with -EINVAL because, in the
>
> Bait -> Bail ?

Fixed this up locally.

[...]

> Thanks for the patch, I missed the fact that a driver could have a
> pdev yet with a failed probe.
>
> Reviewed-by: Maxime Jourdan <mjourdan@...libre.com>

Queud for v5.1 with Maxime's tag. (branch: v5.1/drivers)

Kevin

Powered by blists - more mailing lists