Re: [PATCH] thermal: rcar_thermal: Fix priv->zone error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 21, 2016 at 12:24 PM, Dirk Behme <dirk.behme@xxxxxxxxxxxx> wrote:
> In case thermal_zone_xxx_register() returns an error, priv->zone
> isn't NULL any more, but contains the error code.
>
> This is passed to thermal_zone_device_unregister(), then. This checks
> for priv->zone being NULL, but the error code is != NULL. So it works
> with the error code as a pointer. Crashing immediately.
>
> To fix this, reset priv->zone to NULL before entering
> rcar_gen3_thermal_remove().

Alternatively, you could prevent a non-valid zone pointer from ever
ending up in priv->zone by assigning the zone to a temporary variable,
and only storing that in priv->zone after the error check.

> Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx>

Regardless of the above
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux