vmwgfx: Disallow user space to send present and readback commands
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Родитель
2fcd5a73bf
Коммит
0cff60c625
|
@ -197,6 +197,12 @@ static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv,
|
||||||
} *cmd;
|
} *cmd;
|
||||||
|
|
||||||
cmd = container_of(header, struct vmw_sid_cmd, header);
|
cmd = container_of(header, struct vmw_sid_cmd, header);
|
||||||
|
|
||||||
|
if (unlikely(!sw_context->kernel)) {
|
||||||
|
DRM_ERROR("Kernel only SVGA3d command: %u.\n", cmd->header.id);
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.srcImage.sid);
|
return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.srcImage.sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +216,12 @@ static int vmw_cmd_present_check(struct vmw_private *dev_priv,
|
||||||
} *cmd;
|
} *cmd;
|
||||||
|
|
||||||
cmd = container_of(header, struct vmw_sid_cmd, header);
|
cmd = container_of(header, struct vmw_sid_cmd, header);
|
||||||
|
|
||||||
|
if (unlikely(!sw_context->kernel)) {
|
||||||
|
DRM_ERROR("Kernel only SVGA3d command: %u.\n", cmd->header.id);
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.sid);
|
return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,14 +490,12 @@ static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv,
|
||||||
void *buf, uint32_t *size)
|
void *buf, uint32_t *size)
|
||||||
{
|
{
|
||||||
uint32_t size_remaining = *size;
|
uint32_t size_remaining = *size;
|
||||||
bool need_kernel = true;
|
|
||||||
uint32_t cmd_id;
|
uint32_t cmd_id;
|
||||||
|
|
||||||
cmd_id = le32_to_cpu(((uint32_t *)buf)[0]);
|
cmd_id = le32_to_cpu(((uint32_t *)buf)[0]);
|
||||||
switch (cmd_id) {
|
switch (cmd_id) {
|
||||||
case SVGA_CMD_UPDATE:
|
case SVGA_CMD_UPDATE:
|
||||||
*size = sizeof(uint32_t) + sizeof(SVGAFifoCmdUpdate);
|
*size = sizeof(uint32_t) + sizeof(SVGAFifoCmdUpdate);
|
||||||
need_kernel = false;
|
|
||||||
break;
|
break;
|
||||||
case SVGA_CMD_DEFINE_GMRFB:
|
case SVGA_CMD_DEFINE_GMRFB:
|
||||||
*size = sizeof(uint32_t) + sizeof(SVGAFifoCmdDefineGMRFB);
|
*size = sizeof(uint32_t) + sizeof(SVGAFifoCmdDefineGMRFB);
|
||||||
|
@ -507,7 +517,7 @@ static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(need_kernel && !sw_context->kernel)) {
|
if (unlikely(!sw_context->kernel)) {
|
||||||
DRM_ERROR("Kernel only SVGA command: %u.\n", cmd_id);
|
DRM_ERROR("Kernel only SVGA command: %u.\n", cmd_id);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче