Skip to content

Commit

Permalink
drm: avoid exposing kernel stack in compat_drm_getstats
Browse files Browse the repository at this point in the history
The C standard does not specify the size of the integer used
to store an enum. Hence in structure drm_stats32_t alignment
bytes may exist.

To avoid exposing bytes from the kernel stack it is
necessary to initialize variable s32 completely.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1471802179-2886-1-git-send-email-xypron.glpk@gmx.de
  • Loading branch information
xypron authored and danvet committed Aug 22, 2016
1 parent f5bef0b commit ec913f3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/drm_ioc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
struct drm_stats __user *stats;
int i, err;

memset(&s32, 0, sizeof(drm_stats32_t));
stats = compat_alloc_user_space(sizeof(*stats));
if (!stats)
return -EFAULT;
Expand Down

0 comments on commit ec913f3

Please sign in to comment.