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:48:33 +0000 (17:48 +0200)
commite1133d1506497fa3fddc9bab5338a754433c4ca9
tree440fed2f99881d9db085e371ff8cf4be1c7618a6
parent5edf39c0896a88aa15fce6ed120288ccc495beb7
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