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 E11273F787E; Wed, 20 May 2026 17:59:09 +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=1779299951; cv=none; b=HHBHJZ5X00dqyE4+IXPs0gZrWJVqz6UHUr3SOH9fNY0puWptSb8jkWApcX7R32yZs2EN7bjd7EsQEqMCddxS/BiSwmUuD581GhDeloUFcHt3cQSSXRFCcxeDyKJqKYoRgafKybamjhHYdl0itGF7d3IelXf9RfOUbWrzCc7oB3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779299951; c=relaxed/simple; bh=/FviS/uLb854I5XQtjk9pu2aduC803yELpUEMFqHB1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fu2USB42VKsAaZDbSN/8igoKG8UyjiRId9+QIFmoUDyHQFrWJEi2LdNLcwV6kCSSqgYogpB7t1VdCa0PFy7VGI5HlI8sJWDWH6vhZstdA1RVtMrFKvlS5/aOT/Y7cJKyvuC3h0DiwVjfmzmveUa/hjcGE9m7QnpqjmEN5F6L4A0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rV/IKenW; 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="rV/IKenW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 486E81F000E9; Wed, 20 May 2026 17:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779299949; bh=PBF4Z17LWK0SigoYf7eCx/N83MZ3cklmnvYgltWnGoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rV/IKenW0X+D/lot5MgDEijpD2bBVwM8fOUFuB6lbS6FHHV9UhrIW+4brM33Wtnkk tiCW+w/a2NRi9pbl7qZ/LPW7W2blykjn6Lkmuw9S2M4VDkyGo9VPNcr7B82jO0UV+x NQ9n7lbGmSgHBJo3rMOnUTol+stXFv7YcplCKh60= 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.18 948/957] drm/v3d: Reject empty multisync extension to prevent infinite loop Date: Wed, 20 May 2026 18:23:51 +0200 Message-ID: <20260520162155.160265419@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ashutosh Desai commit fb44d589bf3148e13452185a6e772a7efbf2d684 upstream. 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 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 @@ -390,6 +390,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)