Skip to content

Commit 4a2c8cb

Browse files
osamakaderdliviu
authored andcommitted
drm/panthor: return error on truncated firmware
panthor_fw_load() detects truncated firmware images, but jumps to the common cleanup path without setting ret. If no previous error was recorded, the function can return 0 and treat the invalid firmware as successfully loaded. Set ret to -EINVAL before leaving the truncated-image path. Fixes: 2718d91 ("drm/panthor: Add the FW logical block") Cc: stable@vger.kernel.org Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://patch.msgid.link/20260714163056.22329-1-osama.abdelkader@gmail.com Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
1 parent 5b7b3b6 commit 4a2c8cb

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/gpu/drm/panthor/panthor_fw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ static int panthor_fw_load(struct panthor_device *ptdev)
829829
}
830830

831831
if (hdr.size > iter.size) {
832+
ret = -EINVAL;
832833
drm_err(&ptdev->base, "Firmware image is truncated\n");
833834
goto out;
834835
}

0 commit comments

Comments
 (0)