From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 341E63859D3 for ; Fri, 15 May 2026 20:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778878713; cv=none; b=ZoOlr8G03lRsR04sWI/Vi2mqo/UJUzg4QgDHSjAVbPPLtPmD34s1WWV8zeT+hQi6pqr6mIeaXWrQRnP1CcOvysuIsN6dKf7u/3LuiC+qP8VGxqkOO8VyXqOoYomrWP0EVxe3ZRIVJE5ZPUv/LqAqj4mC/SQFy4+G0Pn8kfWb81M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778878713; c=relaxed/simple; bh=jilvWgd5jjbr40kbsvfgquzJAijjtprPXByKIOhXgHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qiU2RSs8GOE1ekR7oygbShzWrqtIpUMNMJ5CztWPODM5K5ucNDNEhr/NPCzD7XEle89aQd4JgEuZYR0Z6YMOE/u2cbVUaM493vHWdhokB1fDJqRgGIsmquCkQCUDwu0DjvZ/sKwWehSBpeVgo1lOi/y/W66Kg1MuVv/nPNOj1yc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=P7dP4KP2; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="P7dP4KP2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=m35BSj5soItnSKyd2tiGoSq3joZJnp/B6g+b5EdPjZM=; b=P7dP4KP2VbE1HJFivjp84c6dET H8Q3/P2jHPViEmSZAN/H+0x7H8BPJUysnvMFZXyahaSnVMoMwsfND/uFMXz0hT/j1wEcE8jBUH8UI 79iVNTgLPebyrzV3PYZIcsipvxQG54tdXP4HLc/aabIhgTJE4OtOiYGmJX+MbEJjV6DAOSTfAnfTx xcCxdSq1pDd9txzQJhdGFGQQWr7e9xEcEJOtdypCKDDSDYSFcRWBIOQWR3tfl6Z8sPHPitBTqJabq nYXDnFBuItYiC90gt0MFZr6Y8JIxM8fFeuG3cWxHvHP2YPZoqyKvw76VpLtUySrZBSJWEeQn6PZwu NcCoptRQ==; Received: from [189.7.87.67] (helo=prince) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wNzc4-000gv2-7d; Fri, 15 May 2026 22:58:28 +0200 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= To: stable@vger.kernel.org Cc: kernel-dev@igalia.com, Ashutosh Desai , =?UTF-8?q?Ma=C3=ADra=20Canal?= Subject: [PATCH 6.12.y] drm/v3d: Reject empty multisync extension to prevent infinite loop Date: Fri, 15 May 2026 17:58:09 -0300 Message-ID: <20260515205808.2392987-2-mcanal@igalia.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <2026051541-platter-sugar-75ec@gregkh> References: <2026051541-platter-sugar-75ec@gregkh> 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 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 --- drivers/gpu/drm/v3d/v3d_submit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/v3d_submit.c index d607aa9c4ec2..ddc20191a1ce 100644 --- 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_file *file_priv, 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) -- 2.54.0