[Intel-gfx] [PATCH v2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

Michal Wajdeczko michal.wajdeczko at intel.com
Thu Mar 22 17:15:22 UTC 2018


On Thu, 22 Mar 2018 18:05:51 +0100, Piotr PiĆ³rkowski  
<piotr.piorkowski at intel.com> wrote:

> If GuC firmware is not available on the system and we load i915 with  
> enable
> GuC, then we hit this null pointer dereference issue:
>

/snip/

> diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c  
> b/drivers/gpu/drm/i915/intel_uc_fw.c
> index 30c73243f54d..c0663857cd43 100644
> --- a/drivers/gpu/drm/i915/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/intel_uc_fw.c
> @@ -199,7 +199,6 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
>  		       int (*xfer)(struct intel_uc_fw *uc_fw,
>  				   struct i915_vma *vma))
>  {
> -	struct drm_i915_private *i915 = to_i915(uc_fw->obj->base.dev);
>  	struct i915_vma *vma;
>  	int err;
> @@ -224,7 +223,7 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
> 	vma = i915_gem_object_ggtt_pin(uc_fw->obj, NULL, 0, 0,
>  				       PIN_OFFSET_BIAS |
> -				       i915->guc.ggtt_pin_bias);
> +				       to_i915(uc_fw->obj->base.dev)->guc.ggtt_pin_bias);

hmm, sorry, but it looks too ugly and also is over 80

so let's just initialize i915 after checking fetch_status as was suggested
by Jackie (but maybe without GEM_BUG_ON)

/m



More information about the Intel-gfx mailing list