From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04567363C4C; Wed, 20 May 2026 18:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301693; cv=none; b=fcof8fywXfcgxai4q6KulrxILK68ouAnpg29VoEU+/nlXXix8JE36ZSbc0vNYKSmcJo1n5FSXoezshJ9DOFnUKaZwYl8Vpr6guRRxU1YNWr76wnrwNKzXvKwCUbEaqH4Jor1qE2brla6CrXX887ifJt1mWvbrO4XNrsN70rjWXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301693; c=relaxed/simple; bh=VCYGrkB5DSIKUpSiekBjpDXDmfg+Sm/dlye7RZBamCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fOu82KtHGKnRtIfexSqa4j0wQfZdL8G6X+YvNbmQ0coToqZYMyOy560lGXL5V7/uDvGr77gIT5ppE0NaeyDaHQnyB8yOaq/DJrk2ZXx7W9p+sKo+DRA4LuL/cfM0vQ7S2TBS7j62C6e8Ks1Q1XSN1bRWv3R0HeJyYP4sWfxlJNo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GAy0LuK6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GAy0LuK6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AEE91F000E9; Wed, 20 May 2026 18:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301691; bh=yJg0DQmQjPcxkaf3bHjP3a5ttv+stAnPUhYs7bPcPA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GAy0LuK6zgCGgsSOwMsLMYGW97gHZtdeKNMFW+9yeHdAy8f28byLT7q3DbVFMUJoo p3ilqAl6S1dlZy2eHdOLnDsCPqw47a0rzSRba5lXaIaDr7IM2XzBGIrFMoWFLASTZk yI/nZk7Un5f2FiaxnOtNUZbKtP3870jGAIVPtUOc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ashutosh Desai , =?UTF-8?q?Ma=C3=ADra=20Canal?= Subject: [PATCH 6.12 649/666] drm/v3d: Reject empty multisync extension to prevent infinite loop Date: Wed, 20 May 2026 18:24:20 +0200 Message-ID: <20260520162125.350222248@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ashutosh Desai v3d_get_extensions() walks a userspace-provided singly-linked list of ioctl extensions without any bound on the chain length. A local user can craft a self-referential extension (ext->next == &ext) with zero in_sync_count and out_sync_count, which bypasses the existing duplicate- extension guard: if (se->in_sync_count || se->out_sync_count) return -EINVAL; The guard never fires because v3d_get_multisync_post_deps() returns immediately when count is zero, leaving both fields at zero on every iteration. The result is an infinite loop in kernel context, blocking the calling thread and pegging a CPU core indefinitely. Fix this by rejecting a multisync extension where both in_sync_count and out_sync_count are zero in v3d_get_multisync_submit_deps(). An empty multisync carries no synchronization information and serves no useful purpose, so returning -EINVAL for such an extension is the correct defense against this attack vector. Fixes: e4165ae8304e ("drm/v3d: add multiple syncobjs support") Cc: stable@vger.kernel.org Signed-off-by: Ashutosh Desai Link: https://patch.msgid.link/20260415050000.3816128-1-ashutoshdesai993@gmail.com Signed-off-by: Maíra Canal (cherry picked from commit fb44d589bf3148e13452185a6e772a7efbf2d684) Signed-off-by: Maíra Canal Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/v3d/v3d_submit.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/gpu/drm/v3d/v3d_submit.c +++ b/drivers/gpu/drm/v3d/v3d_submit.c @@ -389,6 +389,11 @@ v3d_get_multisync_submit_deps(struct drm if (multisync.pad) return -EINVAL; + if (!multisync.in_sync_count && !multisync.out_sync_count) { + DRM_DEBUG("Empty multisync extension\n"); + return -EINVAL; + } + ret = v3d_get_multisync_post_deps(file_priv, se, multisync.out_sync_count, multisync.out_syncs); if (ret)