linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes
@ 2019-10-18  4:29 Kangjie Lu
  2019-10-22  8:56 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-10-18  4:29 UTC (permalink / raw)
  To: kjlu
  Cc: Patrik Jakobsson, David Airlie, Daniel Vetter, dri-devel, linux-kernel

`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@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));
+
 	switch (refclk) {
 	case 27000:
 		if (target < 200000) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes
  2019-10-18  4:29 [PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes Kangjie Lu
@ 2019-10-22  8:56 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2019-10-22  8:56 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: Patrik Jakobsson, David Airlie, Daniel Vetter, dri-devel, linux-kernel

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@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-22  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18  4:29 [PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes Kangjie Lu
2019-10-22  8:56 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).