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:
c424985
)
drm: Prevent overwriting from userspace underallocating core ioctl structs
author
Chris Wilson
<
[email protected]
>
Wed, 16 Oct 2013 10:22:44 +0000
(11:22 +0100)
committer
Dave Airlie
<
[email protected]
>
Fri, 18 Oct 2013 06:40:37 +0000
(07:40 +0100)
Apply the protections from
commit
1b2f1489633888d4a06028315dc19d65768a1c05
Author: Dave Airlie <
[email protected]
>
Date: Sat Aug 14 20:20:34 2010 +1000
drm: block userspace under allocating buffer and having drivers overwrite it (v2)
to the core ioctl structs as well, for we found one instance where there
is a 32-/64-bit size mismatch and were guilty of writing beyond the end
of the user's buffer.
Signed-off-by: Chris Wilson <
[email protected]
>
Cc: Dave Airlie <
[email protected]
>
Reviewed-by: Ville Syrjälä <
[email protected]
>
Cc:
[email protected]
Cc:
[email protected]
Signed-off-by: Dave Airlie <
[email protected]
>
drivers/gpu/drm/drm_drv.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/drm_drv.c
b/drivers/gpu/drm/drm_drv.c
index e572dd20bdee037fed5cdce356191ea84fd41e09..05ad9ba0a67e8ab4c9e79aade5b8ead441b7f3a8 100644
(file)
--- a/
drivers/gpu/drm/drm_drv.c
+++ b/
drivers/gpu/drm/drm_drv.c
@@
-402,9
+402,16
@@
long drm_ioctl(struct file *filp,
cmd = ioctl->cmd_drv;
}
else if ((nr >= DRM_COMMAND_END) || (nr < DRM_COMMAND_BASE)) {
+ u32 drv_size;
+
ioctl = &drm_ioctls[nr];
- cmd = ioctl->cmd;
+
+ drv_size = _IOC_SIZE(ioctl->cmd);
usize = asize = _IOC_SIZE(cmd);
+ if (drv_size > asize)
+ asize = drv_size;
+
+ cmd = ioctl->cmd;
} else
goto err_i1;