linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/17] drm/tilcdc: fix leak & null ref in panel_connector_get_modes
@ 2020-08-10 19:14 Sasha Levin
  2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 02/17] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Sasha Levin
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Sasha Levin @ 2020-08-10 19:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tomi Valkeinen, Jyri Sarha, Sam Ravnborg, Sasha Levin, dri-devel

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

[ 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 2134bb20fbe9d..2836154dbb126 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -159,12 +159,16 @@ static int panel_connector_get_modes(struct drm_connector *connector)
 	int i;
 
 	for (i = 0; i < timings->num_timings; i++) {
-		struct drm_display_mode *mode = drm_mode_create(dev);
+		struct drm_display_mode *mode;
 		struct videomode vm;
 
 		if (videomode_from_timings(timings, &vm, i))
 			break;
 
+		mode = drm_mode_create(dev);
+		if (!mode)
+			break;
+
 		drm_display_mode_from_videomode(&vm, mode);
 
 		mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-08-10 19:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 19:14 [PATCH AUTOSEL 4.9 01/17] drm/tilcdc: fix leak & null ref in panel_connector_get_modes Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 02/17] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 03/17] fs/btrfs: Add cond_resched() for try_release_extent_mapping() stalls Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 04/17] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 05/17] video: fbdev: neofb: fix memory leak in neo_scan_monitor() Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 06/17] md-cluster: fix wild pointer of unlock_all_bitmaps() Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 07/17] drm/nouveau: fix multiple instances of reference count leaks Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 08/17] drm/debugfs: fix plain echo to connector "force" attribute Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 09/17] mm/mmap.c: Add cond_resched() for exit_mmap() CPU stalls Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 10/17] brcmfmac: To fix Bss Info flag definition Bug Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 11/17] iwlegacy: Check the return value of pcie_capability_read_*() Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 12/17] usb: gadget: net2280: fix memory leak on probe error handling paths Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 13/17] bdc: Fix bug causing crash after multiple disconnects Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 14/17] dyndbg: fix a BUG_ON in ddebug_describe_flags Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 15/17] dyndbg: prefer declarative init in caller, to memset in callee Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 16/17] bcache: fix super block seq numbers comparision in register_cache_set() Sasha Levin
2020-08-10 19:14 ` [PATCH AUTOSEL 4.9 17/17] ACPICA: Do not increment operation_region reference counts for field units Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).