projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
038daf5
)
drm/i915: Report -EFAULT before pwrite fast path into shmemfs
author
Chris Wilson
<
[email protected]
>
Mon, 16 Oct 2017 20:27:32 +0000
(21:27 +0100)
committer
Rodrigo Vivi
<
[email protected]
>
Wed, 18 Oct 2017 15:11:35 +0000
(08:11 -0700)
When pwriting into shmemfs, the fast path pagecache_write does not
notice when it is writing to beyond the end of the truncated shmemfs
inode. Report -EFAULT directly when we try to use pwrite into the
!I915_MADV_WILLNEED object.
Fixes: 7c55e2c5772d ("drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl")
Testcase: igt/gem_madvise/dontneed-before-pwrite
Signed-off-by: Chris Wilson <
[email protected]
>
Cc: Matthew Auld <
[email protected]
>
Cc: Joonas Lahtinen <
[email protected]
>
Cc: Mika Kuoppala <
[email protected]
>
Reviewed-by: Joonas Lahtinen <
[email protected]
>
Link:
https://patchwork.freedesktop.org/patch/msgid/
[email protected]
(cherry picked from commit
a6d65e451cc4e7127698384868a4447ee7be7d16
)
Signed-off-by: Rodrigo Vivi <
[email protected]
>
drivers/gpu/drm/i915/i915_gem.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/i915/i915_gem.c
b/drivers/gpu/drm/i915/i915_gem.c
index af289d35b77a249c8fa9a7aab4a9672592399d51..32e857dc507cf9b1a9247f3bab497616d82e60a9 100644
(file)
--- a/
drivers/gpu/drm/i915/i915_gem.c
+++ b/
drivers/gpu/drm/i915/i915_gem.c
@@
-2657,6
+2657,9
@@
i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj,
if (READ_ONCE(obj->mm.pages))
return -ENODEV;
+ if (obj->mm.madv != I915_MADV_WILLNEED)
+ return -EFAULT;
+
/* Before the pages are instantiated the object is treated as being
* in the CPU domain. The pages will be clflushed as required before
* use, and we can freely write into the pages directly. If userspace