Skip to contentSkip to conversation

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

PATCH In review Kangjie Lu 2 participants 2 messages Oct 18, 2019 – Oct 22, 2019

Subsystems (3)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

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

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.

---
 drivers/gpu/drm/gma500/cdv_intel_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/cdv_intel_display.c +2 -0
index f56852a503e8..8b784947ed3b 100644
@@ -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) {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Kangjie Lu

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.

---
 drivers/gpu/drm/gma500/cdv_intel_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/cdv_intel_display.c +0 -0
index f56852a503e8..8b784947ed3b 100644

drivers/gpu/drm/gma500/cdv_intel_display.c static bool cdv_intel_find_dp_pll(const struct gma_limit_t *limit, · line 408

Quoted 4 lines
drivers/gpu/drm/gma500/cdv_intel_display.c +1 -0
@@ -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

Quoted 7 lines
drivers/gpu/drm/gma500/cdv_intel_display.c +1 -0
+
 	switch (refclk) {
 	case 27000:
 		if (target < 200000) {
Signature · 1 line
2.17.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch