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>
Wed, 19 Aug 2020 06:23:34 +0000 (08:23 +0200)
commit665a80d7aa8ccc163b7ea75a35d48f09299b199f
treec2937bfd8c2a8456f5a438e37f4ccddb5a605c18
parent8904c89418a5a691b16be9d862e8bda5f0332803
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