mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
drm/vmwgfx: Limit the user-space command buffer size
commit 51ab70bed9 upstream.
With older hardware versions, the user could specify arbitrarily large
command buffer sizes, causing a vmalloc / vmap space exhaustion.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
78f2cffcdb
commit
edd2b5fd02
@@ -3830,14 +3830,14 @@ static void *vmw_execbuf_cmdbuf(struct vmw_private *dev_priv,
|
||||
int ret;
|
||||
|
||||
*header = NULL;
|
||||
if (!dev_priv->cman || kernel_commands)
|
||||
return kernel_commands;
|
||||
|
||||
if (command_size > SVGA_CB_MAX_SIZE) {
|
||||
DRM_ERROR("Command buffer is too large.\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (!dev_priv->cman || kernel_commands)
|
||||
return kernel_commands;
|
||||
|
||||
/* If possible, add a little space for fencing. */
|
||||
cmdbuf_size = command_size + 512;
|
||||
cmdbuf_size = min_t(size_t, cmdbuf_size, SVGA_CB_MAX_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user