From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B244DCA5FC5 for ; Wed, 30 Sep 2026 15:45:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EFF810E5D9; Wed, 30 Sep 2026 15:45:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.b="uQ2OPCro"; dkim-atps=neutral Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F3F810E5D9 for ; Wed, 30 Sep 2026 15:45:22 +0000 (UTC) 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 90FF0497; Wed, 30 Sep 2026 08:45:18 -0700 (PDT) Received: from [10.57.77.8] (unknown [10.57.77.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 103613F86F; Wed, 30 Sep 2026 08:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790783122; bh=9fiKbHvHoBtkn+nIT5bE52kZK1Atf9u6tmixiphD12I=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=uQ2OPCrouRwrNNLFKXpSVmny1um/RdTy/AdGxVwtnOq7wr40zlJeYLBBW8ZhYCZPZ x4idiyXVJdxjzhf5EyYS3L4N80Yn0m2KJSB9H/M9gaDCO/XfKxMphhThbgr+Q/s8dx HAjxoM72uuR15d2QHlDQXIOqvrRkjaKVeol8+dL4= Message-ID: <476a6afa-23d4-45e2-816b-e24d524a292c@arm.com> Date: Wed, 30 Sep 2026 16:45:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/panthor: validate userspace queue count against initialized firmware slot count To: Osama Abdelkader , Boris Brezillon , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, sashiko-bot@kernel.org References: <20260804160048.174148-1-osama.abdelkader@gmail.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20260804160048.174148-1-osama.abdelkader@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 04/08/2026 17:00, Osama Abdelkader wrote: > In panthor_drv.c:panthor_ioctl_group_create(), > the queue count is validated against the hardcoded maximum: > > if (!args->queues.count || args->queues.count > MAX_CS_PER_CSG) > return -EINVAL; > > However, if the firmware reports fewer slots than MAX_CS_PER_CSG, > panthor_fw_init_ifaces() will only initialize that smaller number of > stream interfaces. > > If unprivileged userspace requests more queues than the firmware reported > (but no more than MAX_CS_PER_CSG), cs_slot_prog_locked() fetches an > uninitialized stream interface and may crash when dereferencing > cs_iface->input->ringbuf_base. > > Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block") > Cc: stable@vger.kernel.org > Reported-by: sashiko-bot@kernel.org > Closes: https://sashiko.dev/#/patchset/20260803141149.68182-1-osama.abdelkader@gmail.com?part=1 > Signed-off-by: Osama Abdelkader Reviewed-by: Steven Price Looks like this one got missed - I'll push it to drm-misc-fixes. Thanks, Steve > --- > drivers/gpu/drm/panthor/panthor_sched.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c > index 5832dccfc093..64749750e6ee 100644 > --- a/drivers/gpu/drm/panthor/panthor_sched.c > +++ b/drivers/gpu/drm/panthor/panthor_sched.c > @@ -3673,6 +3673,9 @@ int panthor_group_create(struct panthor_file *pfile, > hweight64(group_args->tiler_core_mask) < group_args->max_tiler_cores) > return -EINVAL; > > + if (group_args->queues.count > sched->cs_slot_count) > + return -EINVAL; > + > group = kzalloc_obj(*group); > if (!group) > return -ENOMEM;