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 07:48:04 +0000 (09:48 +0200)
commit6fa182ef2356ebc0f331d724bf5b84a0a22bbb9a
tree40f6325e06f56256ea598de46997e8cfa3037077
parent02f10f560590a8140df0a0a572afff3c9766e8fd
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