Skip to contentSkip to conversation

drm/i915: fix typo causing bad memory access in ring init

PATCH In review Dave Airlie 3 participants 3 messages Aug 14, 2015

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: fix typo causing bad memory access in ring init

From: Dave Airlie <[email protected]>

This is validating from the wrong index.

testing with KASAN found it.

---
 drivers/gpu/drm/i915/i915_cmd_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -1
index 61ae8ff..59f85e2 100644
@@ -534,7 +534,7 @@ static bool validate_cmds_sorted(struct intel_engine_cs *ring,
 
 		for (j = 0; j < table->count; j++) {
 			const struct drm_i915_cmd_descriptor *desc =
-				&table->table[i];
+				&table->table[j];
 			u32 curr = desc->cmd.value & desc->cmd.mask;
 
 			if (curr < previous) {
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 17 lines · Dave Airlie

From: Dave Airlie <[email protected]>

This is validating from the wrong index.

testing with KASAN found it.

---
 drivers/gpu/drm/i915/i915_cmd_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +0 -0
index 61ae8ff..59f85e2 100644

drivers/gpu/drm/i915/i915_cmd_parser.c static bool validate_cmds_sorted(struct intel_engine_cs *ring, · line 538

Quoted 6 lines
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -1
@@ -534,7 +534,7 @@ static bool validate_cmds_sorted(struct intel_engine_cs *ring,
 
 		for (j = 0; j < table->count; j++) {
 			const struct drm_i915_cmd_descriptor *desc =
-				&table->table[i];
+				&table->table[j];
 			u32 curr = desc->cmd.value & desc->cmd.mask;

Which uncovered another problem that the tables weren't sorted and triggered a nasty BUG().

Daniel should have already sent the pair of fixes onwards. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 28 lines · Chris Wilson
Quoted 17 lines · Dave Airlie

From: Dave Airlie <[email protected]>

This is validating from the wrong index.

testing with KASAN found it.

---
 drivers/gpu/drm/i915/i915_cmd_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +0 -0
index 61ae8ff..59f85e2 100644

drivers/gpu/drm/i915/i915_cmd_parser.c static bool validate_cmds_sorted(struct intel_engine_cs *ring, · line 538

Quoted 6 lines
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -1
@@ -534,7 +534,7 @@ static bool validate_cmds_sorted(struct intel_engine_cs *ring,
 
 		for (j = 0; j < table->count; j++) {
 			const struct drm_i915_cmd_descriptor *desc =
-				&table->table[i];
+				&table->table[j];
 			u32 curr = desc->cmd.value & desc->cmd.mask;

Which uncovered another problem that the tables weren't sorted and triggered a nasty BUG().

Quoted 1 line

Daniel should have already sent the pair of fixes onwards.

Yeah if you want this fixed asap you need 9f58582c7ad64f025e7f and 8453580cb8834dedffda from next for other it'll BUG. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx