Skip to content
Commit b18224e9 authored by Michal Srb's avatar Michal Srb Committed by Rodrigo Vivi
Browse files

drm/i915/cmdparser: Check reg_table_count before derefencing.



The find_reg function was assuming that there is always at least one table in
reg_tables. It is not always true.

In case of VCS or VECS, the reg_tables is NULL and reg_table_count is 0,
implying that no register-accessing commands are allowed. However, the command
tables include commands such as MI_STORE_REGISTER_MEM. When trying to check
such command, the find_reg would dereference NULL pointer.

Now it will just return NULL meaning that the register was not found and the
command will be rejected.

Fixes: 76ff480e ("drm/i915/cmdparser: Use binary search for faster register lookup")
Signed-off-by: default avatarMichal Srb <msrb@suse.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180205142916.27092-2-msrb@suse.com


Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180205160438.3267-1-chris@chris-wilson.co.uk


register lookup")
(cherry picked from commit 2f265fad)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 5e1df40f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment