[Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
Matthew Auld
matthew.william.auld at gmail.com
Wed Dec 4 16:52:12 UTC 2019
On Wed, 4 Dec 2019 at 16:29, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>
> From: Chris Wilson <ickle at braswell.alporthouse.com>
>
> Call i915_user_extensions() to validate the arg->extensions pointer, and
> so return consistent error numbers for the future.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_mman.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index 37aabbfa869a..3a3f30bc8ac7 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -17,6 +17,7 @@
> #include "i915_gem_object.h"
> #include "i915_gem_mman.h"
> #include "i915_trace.h"
> +#include "i915_user_extensions.h"
> #include "i915_vma.h"
>
> static inline bool
> @@ -617,9 +618,12 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
> struct drm_i915_private *i915 = to_i915(dev);
> struct drm_i915_gem_mmap_offset *args = data;
> enum i915_mmap_type type;
> + int err;
>
> - if (args->extensions)
> - return -EINVAL;
> + err = i915_user_extensions(u64_to_user_ptr(args->extensions),
> + NULL, 0, NULL);
> + if (err)
> + return err;
Don't we have to check get_user first on the ptr?
>
> switch (args->flags) {
> case I915_MMAP_OFFSET_GTT:
> --
> 2.24.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list