Message ID | 20170120152824.14185-1-michal.winiarski@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jan 20, 2017 at 04:28:23PM +0100, Michał Winiarski wrote: > HuC authentication is called even if HuC firmware is not present in the > system, leading to NULL ptr dereference on not allocated gem_object. > Let's avoid trying to authenticate HuC if its firmware is not loaded > successfully. > > Fixes: dac84a388528 ("drm/i915/huc: Support HuC authentication") > > v2: Check inside the auth function, split the assert (Michał) > > Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> > Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko.intel.com> > --- > drivers/gpu/drm/i915/intel_huc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c > index 897ef31..d1e65fa 100644 > --- a/drivers/gpu/drm/i915/intel_huc.c > +++ b/drivers/gpu/drm/i915/intel_huc.c > @@ -299,6 +299,9 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv) > int ret; > u32 data[2]; > > + if (huc_fw->load_status != INTEL_UC_FIRMWARE_SUCCESS) > + return; > + > vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0, > PIN_OFFSET_BIAS | GUC_WOPCM_TOP); > if (IS_ERR(vma)) { > -- > 2.9.3 >
diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c index 897ef31..d1e65fa 100644 --- a/drivers/gpu/drm/i915/intel_huc.c +++ b/drivers/gpu/drm/i915/intel_huc.c @@ -299,6 +299,9 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv) int ret; u32 data[2]; + if (huc_fw->load_status != INTEL_UC_FIRMWARE_SUCCESS) + return; + vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0, PIN_OFFSET_BIAS | GUC_WOPCM_TOP); if (IS_ERR(vma)) {
HuC authentication is called even if HuC firmware is not present in the system, leading to NULL ptr dereference on not allocated gem_object. Let's avoid trying to authenticate HuC if its firmware is not loaded successfully. Fixes: dac84a388528 ("drm/i915/huc: Support HuC authentication") v2: Check inside the auth function, split the assert (Michał) Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> --- drivers/gpu/drm/i915/intel_huc.c | 3 +++ 1 file changed, 3 insertions(+)