From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386531; b=lwQWf3jZ38YJ1w1bHcwFTqGMOHqjA2IHMAzvGYD3NT8qtaT+mFzM+sufyXFU+7yXhzeb bbrZXYOJ5mI6q6YprPPLym14bFTH7zrWRKiMNbA+tiKM/DztaLyEESksBvETm/st4wM/N WzkRRnqeb/0MdbU+JxXUX2YqzoFwJHz/lqH/Yur6aTZS/0i3rh2zAhru8Tm9NMi2t3AXm fB6CQtBZjbkzJ+dVgdIwFejDw1FhasFqRvq8Z2oex4M7u/+ja4DppWYwAW4yJkkfLlf9h aPgBl9/yvzIaAf5N41Qf7rgFCmUflb1sUArKI1i8JhVJv7iT/b4GucW0SOQHLOmwDIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386531; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=0DqjfgR1WsQymNZrYj3+ZVp2HmKUEXtZ1KVkmRue9Vo=; b=uF5XUh0XguAjzcRtw82VKANFR/2QslBG+5Tjhogll3jiGK5G7L322Cpty26wtVeukP0I +Gb4cLtoCwbT7hxBRhiaDdd2pmgwk7jNrY6mQmaREwee9lFuFSorGM+K8KnQi7CPRkfIt yc+XMJtaQrunCuyvm1HzHWtB2XpZY92hwyJMiyvlOZ8NRizsyS6gpr8HNbUHamcVbDrNX LNPPxqtAUDxSIzIOhqjEK7GaqFprgcqjfvk0ro4nMWgHD+4xf08OU681QUbUvWIoADk1y sQP0KCPushNR5wQx/ldLeEK2KPvjXT1DhR1UQgF6pVpsx+IvJdLEOkMaPxGiM1SP3/w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=IMZukPRh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 315A3606A32D; Fri, 4 Dec 2026 12:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=IMZukPRh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C1D91F00934; Fri, 4 Dec 2026 12:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386531; bh=0DqjfgR1WsQymNZrYj3+ZVp2HmKUEXtZ1KVkmRue9Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IMZukPRh/Qonh5cQuOxkD/kNaNgG5owed2ByNJDavO+L0cX7J2XLgGar4ak7tecnv QKSrLijhCGfUEMhPSLYyIg3VI28DJA3m5MyfaK6HL0pUgLAwf9Qy0SpUqSQwG/TWAd cBMuaHqx32ppRlrsUkzeb2Z2UEMx0/+PEBVPuDGA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vladimir Popov , Zack Rusin Subject: [PATCH 6.6 1002/1167] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Date: Fri, 4 Dec 2026 19:07:09 +0900 Message-ID: <20261204100728.309916779@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vladimir Popov commit 06f8a6708a98dff199ef7ea553b092efc38b4eab upstream. If vmw_execbuf_fence_commands() call fails in vmw_kms_helper_validation_finish(), it sets *p_fence = NULL. If ctx->bo_list is not empty, the caller, vmw_kms_helper_validation_finish(), passes the fence through a chain of functions to dma_fence_is_array(), which causes a NULL pointer dereference in dma_fence_is_array(): vmw_kms_helper_validation_finish() // pass NULL fence vmw_validation_done() vmw_validation_bo_fence() ttm_eu_fence_buffer_objects() // pass NULL fence dma_resv_add_fence() dma_fence_is_container() dma_fence_is_array() // NULL deref Fix this by adding a NULL check in vmw_validation_bo_fence(): if the fence is NULL, fall back to ttm_eu_backoff_reservation()to safely release the buffer object reservations without attempting to add a NULL fence to dma_resv. This is safe because when fence is NULL, vmw_fallback_wait() has already been called inside vmw_execbuf_fence_commands() to synchronize the GPU. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 038ecc503236 ("drm/vmwgfx: Add a validation module v2") Cc: stable@vger.kernel.org Signed-off-by: Vladimir Popov Reviewed-by: Zack Rusin Signed-off-by: Zack Rusin Link: https://patch.msgid.link/20260414105529.9883-1-popov.nkv@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h @@ -134,16 +134,23 @@ vmw_validation_bo_reserve(struct vmw_val * vmw_validation_bo_fence - Unreserve and fence buffer objects registered * with a validation context * @ctx: The validation context + * @fence: Fence with which to fence all buffer objects taking part in the + * command submission. * * This function unreserves the buffer objects previously reserved using - * vmw_validation_bo_reserve, and fences them with a fence object. + * vmw_validation_bo_reserve, and fences them with a fence object if the + * given fence object is not NULL. */ static inline void vmw_validation_bo_fence(struct vmw_validation_context *ctx, struct vmw_fence_obj *fence) { - ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list, - (void *) fence); + /* fence is able to be NULL if vmw_execbuf_fence_commands() fails */ + if (fence) + ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list, + (void *)fence); + else + ttm_eu_backoff_reservation(&ctx->ticket, &ctx->bo_list); } /**