drm/i915/huc: Avoid attempting to authenticate non-existent fw
authorMichał Winiarski <michal.winiarski@intel.com>
Fri, 20 Jan 2017 19:23:46 +0000 (20:23 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 20 Jan 2017 19:59:53 +0000 (19:59 +0000)
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ł)
v3: Oops, hit send before compiling, s/huc_fw/huc->fw

Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170120192348.2049-1-michal.winiarski@intel.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_huc.c

index 897ef31d865ed0b70b0d57c091362349da0bad00..5edd4f7c3c60cc4d9475288d336f23464cf73e65 100644 (file)
@@ -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)) {