OSDN Git Service

drm/i915/uc: Fix two issues with over-size firmware files
authorJohn Harrison <John.C.Harrison@Intel.com>
Wed, 21 Dec 2022 19:30:31 +0000 (11:30 -0800)
committerJohn Harrison <John.C.Harrison@Intel.com>
Thu, 22 Dec 2022 20:42:23 +0000 (12:42 -0800)
commit4071d98b296a5bc5fd4b15ec651bd05800ec9510
tree7161669c5e0cf5c5e08f56d32a624e832906b4be
parentd830e0dc2e2d4826ebc6a429c2bc098848c9eeda
drm/i915/uc: Fix two issues with over-size firmware files

In the case where a firmware file is too large (e.g. someone
downloaded a web page ASCII dump from github...), the firmware object
is released but the pointer is not zerod. If no other firmware file
was found then release would be called again leading to a double kfree.

Also, the size check was only being applied to the initial firmware
load not any of the subsequent attempts. So move the check into a
wrapper that is used for all loads.

Fixes: 016241168dc5 ("drm/i915/uc: use different ggtt pin offsets for uc loads")
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221221193031.687266-4-John.C.Harrison@Intel.com
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c