[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190731.185705.323737673654483593.davem@davemloft.net>
Date: Wed, 31 Jul 2019 18:57:05 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: baijiaju1990@...il.com
Cc: andrew@...n.ch, f.fainelli@...il.com, hkallweit1@...il.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] net: phy: phy_led_triggers: Fix a possible
null-pointer dereference in phy_led_trigger_change_speed()
From: Jia-Ju Bai <baijiaju1990@...il.com>
Date: Tue, 30 Jul 2019 16:08:13 +0800
> In phy_led_trigger_change_speed(), there is an if statement on line 48
> to check whether phy->last_triggered is NULL:
> if (!phy->last_triggered)
>
> When phy->last_triggered is NULL, it is used on line 52:
> led_trigger_event(&phy->last_triggered->trigger, LED_OFF);
>
> Thus, a possible null-pointer dereference may occur.
>
> To fix this bug, led_trigger_event(&phy->last_triggered->trigger,
> LED_OFF) is called when phy->last_triggered is not NULL.
>
> This bug is found by a static analysis tool STCheck written by
> the OSLAB group in Tsinghua University.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
Applied, thanks.
Powered by blists - more mailing lists