linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpu: radeon: fix a potential NULL-pointer dereference
@ 2019-03-23  2:29 Kangjie Lu
  2019-03-25 10:32 ` Michel Dänzer
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-23  2:29 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Alex Deucher, Christian König,
	David (ChunMing) Zhou, David Airlie, Daniel Vetter, amd-gfx,
	dri-devel, linux-kernel

In case alloc_workqueue fails, the fix frees memory and
returns to avoid potential NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/gpu/drm/radeon/radeon_display.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index aa898c699101..a31305755a77 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -678,6 +678,11 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
 	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
 	radeon_crtc->crtc_id = index;
 	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
+	if (!radeon_crtc->flip_queue) {
+		DRM_ERROR("failed to allocate the flip queue\n");
+		kfree(radeon_crtc);
+		return;
+	}
 	rdev->mode_info.crtcs[index] = radeon_crtc;
 
 	if (rdev->family >= CHIP_BONAIRE) {
-- 
2.17.1


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

end of thread, other threads:[~2019-03-26  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23  2:29 [PATCH] gpu: radeon: fix a potential NULL-pointer dereference Kangjie Lu
2019-03-25 10:32 ` Michel Dänzer
2019-03-25 21:05   ` [PATCH v2] " Kangjie Lu
2019-03-26  9:51     ` Michel Dänzer

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).