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=1796380756; b=jbnTdlO4oZdunjZBYImvnso5NcSfdpMD28cjBn7yKpswL66v0ymSMHlfvY0V3cQiseqM 2qjJyd7/GIyFwWsXIWE3lM7QnaM/M2fY4ZYf5NQB95ej6aR0iFFnrlV1RQ7tSwmBbrOZ0 u/o4UNElMtHI0rgseQbVA5+u4o3RNWD44NYzTnONjmBUGducDTymVh3mThCen7K2cs5P2 ecYZSO5tGkTeZOcepwVOcIS9Lg8PMpJIr2FhilJcR6NVyDKAPKi3QNweVLHoGwga68Smq o72S9OXidTiVYj/5zI6RrZYni6bF4yD1/aAzzOyCdKwmnJZUgbtde+6JKrEQJsCHp7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380756; 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=QlXtdANZw/8FHjg+/PqPGfFJzGYuIhZQbGyQLDycgYM=; b=emEKZIU57gBXn2rjWiVMOtecMjCcU3VXQ1KolPkmSarp26y2fe/5LNGYQzK9546lscXD aySD3vPdLOqevifBkv0+QNoFP2leTxXHlZRBALqRypRp3lofJVrcntddbzWtasoCywaSN 3fxz6yFnHlj48RcB5k9TBU4aBD5cNSvWgrSVQj8LoJcmT0Wzeither0yusx4sMhIqSVhS ++cAPpbEc1qE2yzpUXzs9Wr9BMNdk5fJN91o1XZ+u8ZvFoJBCQh1zp5uK8UVB1ZO8qsuf m9ltquTL9IODsvY1pw7aKkrvIc9WqvVBvowAo9QQQ5id3parDrK3+2iI+sgai6uSYYw== 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=SrWg4B7t; 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 715D8606A322; Fri, 4 Dec 2026 10:39:16 +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=SrWg4B7t Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFB021F000CE; Fri, 4 Dec 2026 10:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380756; bh=QlXtdANZw/8FHjg+/PqPGfFJzGYuIhZQbGyQLDycgYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SrWg4B7tq2/i7lJYd+lw2bwbDeCYFQKoo03wg2qwDVc6dAgjU7iGAn2xPdQ+gsvjP 0mt65MAqgO/IHAURMxYjhSWj/Rfl//0KyoSmAp6yJJv6Uyvw3joiAw8XLSENwbPJUI c56A2P/KS/l3RuTLCM0vJ/VZjdK0zoKQ3GKJ/C7o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vladimir Popov , Zack Rusin Subject: [PATCH 7.3 412/742] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Date: Fri, 4 Dec 2026 19:04:36 +0900 Message-ID: <20261204100646.045724434@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -127,16 +127,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); } /**