[PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes

Daniel Vetter daniel at ffwll.ch
Tue Oct 22 08:56:30 UTC 2019


On Thu, Oct 17, 2019 at 11:29:53PM -0500, Kangjie Lu wrote:
> `best_clock` is an object that may be sent out. Object `clock`
> contains uninitialized bytes that are copied to `best_clock`,
> which leads to memory disclosure and information leak.
> 
> Signed-off-by: Kangjie Lu <kjlu at umn.edu>
> ---
>  drivers/gpu/drm/gma500/cdv_intel_display.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
> index f56852a503e8..8b784947ed3b 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_display.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
> @@ -405,6 +405,8 @@ static bool cdv_intel_find_dp_pll(const struct gma_limit_t *limit,
>  	struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
>  	struct gma_clock_t clock;
>  
> +	memset(&clock, 0, sizeof(clock));

I guess whatever analyzer you use for this doesn't see past the ->clock
vfunc call, so shouldn't be a real issue. Also, it's not an information
disclosure since we only ever leak this to other kernel code, never
userspace.

But I guess doesn't hurt, so applied.
-Daniel

> +
>  	switch (refclk) {
>  	case 27000:
>  		if (target < 200000) {
> -- 
> 2.17.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list