[PATCH 4.12 59/99] drm/i915/gvt: Fix the kernel null pointer error

From: Greg Kroah-Hartman
Date: Mon Aug 28 2017 - 04:08:22 EST


4.12-stable review patch. If anyone has any objections, please let me know.

------------------

From: fred gao <fred.gao@xxxxxxxxx>

commit ffeaf9aaf97b4bdaf114d6df52f800d71918768c upstream.

once error happens in shadow_indirect_ctx function, the variable
wa_ctx->indirect_ctx.obj is not initialized but accessed, so the
kernel null point panic occurs.

Fixes: 894cf7d15634 ("drm/i915/gvt: i915_gem_object_create() returns an error pointer")
Signed-off-by: fred gao <fred.gao@xxxxxxxxx>
Signed-off-by: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/i915/gvt/cmd_parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -2754,7 +2754,7 @@ static int shadow_indirect_ctx(struct in
unmap_src:
i915_gem_object_unpin_map(obj);
put_obj:
- i915_gem_object_put(wa_ctx->indirect_ctx.obj);
+ i915_gem_object_put(obj);
return ret;
}