From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9B6033D503 for ; Tue, 28 Jul 2026 16:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785254984; cv=none; b=o4wvZJFEXbPN1X/OHNPmIRNrK3mCJnAGFA+UOt74Hghw+wG4hU7XiYo2JQZec5hfGTvznzXK2cdzAoQCr+MjlcIIREKSwtnv8EDJeCj6xD4IIaiM19wFSw+ts1Hr+RVxMIRkh2RaSNcQ7hQs1LpXdPUCJMrh5n7U3eBsR3W8mHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785254984; c=relaxed/simple; bh=q6mrCLoh7TTNCGFPKiKdXibBGMULCO0YWhvoUknTgb4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=feMREAK91RzQx/uIhHd86W7FFtcY87HFrkGmvk3aT8VO0sjIP8vRDxPtTP+enePHzqJswKGyGfJwKv9eA5VCVt7uQlkZc81xIWeHTq83gcegQBpspqwnSANWKF+gHGrIKD0lWk+jfAcr9rsp8lFH1tnqSlED7pzks02Wil62PF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=eUQgnGdP; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="eUQgnGdP" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EBA54169E for ; Tue, 28 Jul 2026 09:09:38 -0700 (PDT) Received: from [10.2.11.34] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C009E3F763 for ; Tue, 28 Jul 2026 09:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785254983; bh=q6mrCLoh7TTNCGFPKiKdXibBGMULCO0YWhvoUknTgb4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eUQgnGdP+9tkIV4/3tLY4vjX3YhgjacVBvYpkjKFTg+7FkuRjTPoNF7GH/QgQF8a5 n8G1Mmg/Wx0jegBgPohsg84eCKriZPkc2ZIavW79jXVPBPOdrsIkWNf0qMzKdFSg3u QtwM8sfk7z+qACZwa14vdBYJu9Tskal8muSpiQPk= Date: Tue, 28 Jul 2026 17:09:29 +0100 From: Liviu Dudau To: Osama Abdelkader Cc: Boris Brezillon , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] drm/panthor: skip zero-sized firmware sections Message-ID: References: <20260724172621.63046-1-osama.abdelkader@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260724172621.63046-1-osama.abdelkader@gmail.com> On Fri, Jul 24, 2026 at 07:26:20PM +0200, Osama Abdelkader wrote: > 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 Reviewed-by: Liviu Dudau Best regards, Liviu > --- > drivers/gpu/drm/panthor/panthor_fw.c | 4 ++++ > 1 file changed, 4 insertions(+) > > v2: > - Accept zero-sized firmware sections as no-op entries instead of rejecting > them, as suggested by Steven. > > diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c > index a338c4f0a7f5..66d9f5947af0 100644 > --- a/drivers/gpu/drm/panthor/panthor_fw.c > +++ b/drivers/gpu/drm/panthor/panthor_fw.c > @@ -601,8 +601,11 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev, > if (data_size > section_size) { > drm_err(&ptdev->base, "Firmware corrupted, section data exceeds section size\n"); > return -EINVAL; > } > > + if (!section_size) > + return 0; > + > name_len = iter->size - iter->offset; > > section = drmm_kzalloc(&ptdev->base, sizeof(*section), GFP_KERNEL); > -- > 2.43.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯