drm/tilcdc: fix leak & null ref in panel_connector_get_modes
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 29 Apr 2020 10:42:32 +0000 (13:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 08:52:58 +0000 (10:52 +0200)
commitcccde76882a11925ace084dfe22ee98cb2f12f2a
tree15721140786cc86385873576277d4f9aa9390418
parent3ceafa420d090e623fc5eb1ac8f3a8c5c9dc4037
drm/tilcdc: fix leak & null ref in panel_connector_get_modes

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkeinen@ti.com
Reviewed-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/tilcdc/tilcdc_panel.c