Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers")
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241029083429.1185479-1-chenridong@huaweicloud.com

authored by

Chen Ridong and committed by
Zack Rusin
93d1f41a 9776c0a7

+2
+2
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 1265 1265 struct vmw_framebuffer_surface *vfbs = vmw_framebuffer_to_vfbs(fb); 1266 1266 struct vmw_bo *bo = vmw_user_object_buffer(&vfbs->uo); 1267 1267 1268 + if (WARN_ON(!bo)) 1269 + return -EINVAL; 1268 1270 return drm_gem_handle_create(file_priv, &bo->tbo.base, handle); 1269 1271 } 1270 1272