]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 30 Dec 2022 08:04:45 +0000 (03:04 -0500)
commit11ce8fd8fd8718247f17475802639cd7e2d3765c
tree5b0dcd24c6d41724dae62b6c7d81ff59fc27975b
parent3f882f2d4f689627c1566c2c92087bc3ff734953
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
(cherry picked from commit 4071d98b296a5bc5fd4b15ec651bd05800ec9510)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c