diff options
author | Rob Clark <robdclark@gmail.com> | 2016-02-03 13:12:31 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2016-03-03 11:55:30 -0500 |
commit | c01a958eca6e7f23bc49058feb66942ebcacb277 (patch) | |
tree | 28061c5059ccf8c13d4599f0599cca53841e5156 /drivers/gpu/drm/msm/msm_gem_submit.c | |
parent | 1e2c8e7a2f3f5b339a7bd972ad09c66ea52acea8 (diff) | |
download | linux-c01a958eca6e7f23bc49058feb66942ebcacb277.tar.gz linux-c01a958eca6e7f23bc49058feb66942ebcacb277.tar.bz2 linux-c01a958eca6e7f23bc49058feb66942ebcacb277.zip |
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: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem_submit.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem_submit.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 6d7cd3fe21e7..06f6ea9ccba0 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -323,18 +323,19 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, struct drm_msm_gem_submit *args = data; struct msm_file_private *ctx = file->driver_priv; struct msm_gem_submit *submit; - struct msm_gpu *gpu; + struct msm_gpu *gpu = priv->gpu; unsigned i; int ret; + if (!gpu) + return -ENXIO; + /* for now, we just have 3d pipe.. eventually this would need to * be more clever to dispatch to appropriate gpu module: */ if (args->pipe != MSM_PIPE_3D0) return -EINVAL; - gpu = priv->gpu; - if (args->nr_cmds > MAX_CMDS) return -EINVAL; |