Commit c01a958e authored by Rob Clark's avatar Rob Clark

drm/msm: reject submit ioctl if no gpu

Existing userspace wouldn't get this far, since getparam ioctl would
have failed and it would have bailed out creating a screen/context.

But all the same, we shouldn't let evil or confused userspace cause a
null ptr deref.
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 1e2c8e7a
...@@ -323,18 +323,19 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -323,18 +323,19 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
struct drm_msm_gem_submit *args = data; struct drm_msm_gem_submit *args = data;
struct msm_file_private *ctx = file->driver_priv; struct msm_file_private *ctx = file->driver_priv;
struct msm_gem_submit *submit; struct msm_gem_submit *submit;
struct msm_gpu *gpu; struct msm_gpu *gpu = priv->gpu;
unsigned i; unsigned i;
int ret; int ret;
if (!gpu)
return -ENXIO;
/* for now, we just have 3d pipe.. eventually this would need to /* for now, we just have 3d pipe.. eventually this would need to
* be more clever to dispatch to appropriate gpu module: * be more clever to dispatch to appropriate gpu module:
*/ */
if (args->pipe != MSM_PIPE_3D0) if (args->pipe != MSM_PIPE_3D0)
return -EINVAL; return -EINVAL;
gpu = priv->gpu;
if (args->nr_cmds > MAX_CMDS) if (args->nr_cmds > MAX_CMDS)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment