staging: greybus: fix a missing-check bug in gb_lights_light_config()
authorChen Zhou <chenzhou10@huawei.com>
Wed, 1 Apr 2020 03:00:17 +0000 (11:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:20 +0000 (17:50 +0200)
commit7bf3a213f79ec013aa8e9f7e1b99fe7d7891bc05
treece2ee8f50bb96fea1947493ebdbcdc7f2348b87f
parentc970dcc085b89ca93a9b934a90091f904e5f404b
staging: greybus: fix a missing-check bug in gb_lights_light_config()

[ Upstream commit 9bb086e5ba9495ac150fbbcc5c8c2bccc06261dd ]

In gb_lights_light_config(), 'light->name' is allocated by kstrndup().
It returns NULL when fails, add check for it.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Link: https://lore.kernel.org/r/20200401030017.100274-1-chenzhou10@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/greybus/light.c