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=1796389220; b=r1l4CLouCDz8bxJrg3RhVVWgyM3zIvKVBXFK/GuNp9jRnH5fY491b1YyNMPNkFObXZn+ 7Wh68W0ev4G2TbW5eM7wQIeIVSFEQ2OvKf5jynsQyv2geDm53zj4ODEPOCtZgYEbE7F7W ij6Y0sP32P1FhzevkuZ/sUJgVMU6/HWYcAgM4TfWh0lHAnNay4xZqlZxYffAPaa1fO4bH 8Kyu+XNfw31Xy4lSppgW+tyUnBcdOsmXN+uHqHJ56AWIHmo7zsGxjZvCpTauSzB5NlMDb THVJWKhoYX4vSSXrqbgnzbLGN8q+Y/mpg/pjTC6cvyMf2eB5DaQWMCaJTzY2yMrv3Xw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389220; 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=uatXvs2xFdWJPGlext73lNtuVe2BMjxgmZk1gfdx8pk=; b=V0CPQjNMZNmLV8/GYU6KGWh7cuqZaMZTccObh1SYvnKUvv69+kl+5G9mOhI+DYRFaqqG h+0VzAAOvV+CYRhuqUd0NDhzaqHXKZ7kZ9v7NM3Q1HxKkytDixi+tfqJGQM23i2MQpZdI xq2Hs6nRO2YLprHxpbGjMLkmMfIFXVpg7qj8jX2h5nTPJI7n+wWBRa+0Nof+7zz5vFONA NTVbuaUxmtzGQSkDB7MhSv0dVNNwOke7VXKQ3jEu48XliRxM+FBteUmGwtJwg3rzYxqAY rGCCBCbhLy23J2cT03ARapezEIPe2WZiHjZxuW4vlZwfZtfTbVIathw231JEKyjIErQ== 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=Qtb1L5cj; 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 459E7606A33E; Fri, 4 Dec 2026 13:00:20 +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=Qtb1L5cj Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DCE31F00934; Fri, 4 Dec 2026 13:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389220; bh=uatXvs2xFdWJPGlext73lNtuVe2BMjxgmZk1gfdx8pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Qtb1L5cjF93MpKg7maZjnV5Wl4k7EoD2IeMhhUtUYqNla7YMRk94kvM69KIy5vG6N dmE05uIBUoXXcCrN+MKJvu0qRWZq/w2OBphmitZxvpt8fhsTTavyiuVu56/Hw2EIeA W9SxWrK5AJ4SRo4EGKqS46ChxbM3n+Rc/i86wMhM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vladimir Popov , Zack Rusin Subject: [PATCH 6.1 0910/1059] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Date: Fri, 4 Dec 2026 19:07:21 +0900 Message-ID: <20261204100707.589649592@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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); } /**