drm/gem: drm_gem_dumb_map_offset(): reject dma-buf
authorNoralf Trønnes <[email protected]>
Thu, 17 Aug 2017 16:21:30 +0000 (18:21 +0200)
committerNoralf Trønnes <[email protected]>
Sat, 2 Sep 2017 12:21:52 +0000 (14:21 +0200)
Reject mapping an imported dma-buf since is's an invalid use-case.

Cc: Philipp Zabel <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: Daniel Vetter <[email protected]>
Signed-off-by: Noralf Trønnes <[email protected]>
Acked-by: Daniel Vetter <[email protected]>
Acked-by: Eric Anholt <[email protected]>
Acked-by: Thierry Reding <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/drm_gem.c

index 88c6d78ee2d59d94f291b5b8cfdd6503ff581d42..8bea0326e7a79a76ef4677ae23174cbebe693280 100644 (file)
@@ -333,6 +333,12 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
        if (!obj)
                return -ENOENT;
 
+       /* Don't allow imported objects to be mapped */
+       if (obj->import_attach) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        ret = drm_gem_create_mmap_offset(obj);
        if (ret)
                goto out;