drm: vkms: check status of alloc_ordered_workqueue
authorKangjie Lu <kjlu@umn.edu>
Sat, 9 Mar 2019 04:36:27 +0000 (22:36 -0600)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 25 Mar 2019 08:33:42 +0000 (09:33 +0100)
alloc_ordered_workqueue may fail and return NULL.
The fix returns ENOMEM when it fails to avoid potential NULL
pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190309043628.6078-1-kjlu@umn.edu
drivers/gpu/drm/vkms/vkms_crtc.c

index 8a9aeb0a9ea805b49f9af8e20692821db0a3e6b1..bb66dbcd5e3f96c37ab52dcf2feae9ccd75abbfd 100644 (file)
@@ -219,6 +219,8 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
        spin_lock_init(&vkms_out->state_lock);
 
        vkms_out->crc_workq = alloc_ordered_workqueue("vkms_crc_workq", 0);
+       if (!vkms_out->crc_workq)
+               return -ENOMEM;
 
        return ret;
 }