mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/16] 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.4 02/16] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Sasha Levin
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ 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 0af8bed7ce1ee..08d8f608be632 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -177,12 +177,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	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-08-11 13:48 UTC | newest]

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

all inboxes | Powered by JetHome®