Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
da761a6e
Commit
da761a6e
authored
Oct 27, 2010
by
Chris Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/i915: Bail early if we try to mmap an object too large to be mapped.
Signed-off-by:
Chris Wilson
<
chris@chris-wilson.co.uk
>
parent
fb7d516a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem.c
+12
-0
No files found.
drivers/gpu/drm/i915/i915_gem.c
View file @
da761a6e
...
...
@@ -1258,6 +1258,7 @@ int
i915_gem_mmap_ioctl
(
struct
drm_device
*
dev
,
void
*
data
,
struct
drm_file
*
file_priv
)
{
struct
drm_i915_private
*
dev_priv
=
dev
->
dev_private
;
struct
drm_i915_gem_mmap
*
args
=
data
;
struct
drm_gem_object
*
obj
;
loff_t
offset
;
...
...
@@ -1270,6 +1271,11 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
if
(
obj
==
NULL
)
return
-
ENOENT
;
if
(
obj
->
size
>
dev_priv
->
mm
.
gtt_mappable_end
)
{
drm_gem_object_unreference_unlocked
(
obj
);
return
-
E2BIG
;
}
offset
=
args
->
offset
;
down_write
(
&
current
->
mm
->
mmap_sem
);
...
...
@@ -1547,6 +1553,7 @@ int
i915_gem_mmap_gtt_ioctl
(
struct
drm_device
*
dev
,
void
*
data
,
struct
drm_file
*
file_priv
)
{
struct
drm_i915_private
*
dev_priv
=
dev
->
dev_private
;
struct
drm_i915_gem_mmap_gtt
*
args
=
data
;
struct
drm_gem_object
*
obj
;
struct
drm_i915_gem_object
*
obj_priv
;
...
...
@@ -1566,6 +1573,11 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
}
obj_priv
=
to_intel_bo
(
obj
);
if
(
obj
->
size
>
dev_priv
->
mm
.
gtt_mappable_end
)
{
ret
=
-
E2BIG
;
goto
unlock
;
}
if
(
obj_priv
->
madv
!=
I915_MADV_WILLNEED
)
{
DRM_ERROR
(
"Attempting to mmap a purgeable buffer
\n
"
);
ret
=
-
EINVAL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment