]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panthor: skip zero-sized firmware sections
authorOsama Abdelkader <osama.abdelkader@gmail.com>
Fri, 24 Jul 2026 17:26:20 +0000 (19:26 +0200)
committerSteven Price <steven.price@arm.com>
Thu, 30 Jul 2026 09:49:57 +0000 (10:49 +0100)
panthor_fw_load_section_entry() skips BO creation when the firmware section
VA range is empty. If such a section is added to the firmware section list,
section->mem is left as NULL.

Later reload and unplug paths iterate over all firmware sections and
dereference section->mem, which can lead to a NULL pointer dereference.

Zero-sized firmware sections are valid, so accept them as no-op entries but
skip adding them to the section list.

Fixes: 2718d91816ee ("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: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20260724172621.63046-1-osama.abdelkader@gmail.com
Signed-off-by: Steven Price <steven.price@arm.com>
drivers/gpu/drm/panthor/panthor_fw.c

index e45933e333b5b62f3b64df3bdb006a254ed320a7..fa88b2f9da76dcb587fabedce2f47984aaa5cd29 100644 (file)
@@ -603,6 +603,9 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
                return -EINVAL;
        }
 
+       if (!section_size)
+               return 0;
+
        name_len = iter->size - iter->offset;
 
        section = drmm_kzalloc(&ptdev->base, sizeof(*section), GFP_KERNEL);