Skip to content

Commit 93d1f41

Browse files
Chen Ridongzackr
authored andcommitted
drm/vmwgfx: avoid null_ptr_deref in vmw_framebuffer_surface_create_handle
The 'vmw_user_object_buffer' function may return NULL with incorrect inputs. To avoid possible null pointer dereference, add a check whether the 'bo' is NULL in the vmw_framebuffer_surface_create_handle. Fixes: d6667f0 ("drm/vmwgfx: Fix handling of dumb buffers") Signed-off-by: Chen Ridong <[email protected]> Signed-off-by: Zack Rusin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9776c0a commit 93d1f41

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,8 @@ static int vmw_framebuffer_surface_create_handle(struct drm_framebuffer *fb,
12651265
struct vmw_framebuffer_surface *vfbs = vmw_framebuffer_to_vfbs(fb);
12661266
struct vmw_bo *bo = vmw_user_object_buffer(&vfbs->uo);
12671267

1268+
if (WARN_ON(!bo))
1269+
return -EINVAL;
12681270
return drm_gem_handle_create(file_priv, &bo->tbo.base, handle);
12691271
}
12701272

0 commit comments

Comments
 (0)