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=1796383725; b=meAuLCAn7NROJEQwYo3/YI+HZIhqDIrnVhpDXSr3LIWfavDVXwqRUKVfgF5wOWYlFEF6 0q/cIiohihdZTG4Vldh4XG6OE0wHBv2zab+oHylcvy3SVhkmvBEDZPxzTgxqXjHr5a49z aEkvcIaJuspFQBUoWcZXTOmPBh+E3pIHwvg/ZytSXwBuvr/0Q9HFcX6XslJon8zvlGgtM r9UfMmkx9zZARr+C66gOAiGHgSAb+f8TXGl37icdT2vaAiG1n9zWv7D1M5rYIpuxvk0VZ 63AVVf/oa+/ZYJc6wwoDdVPeIqlR6rjZl3amXkRFIUvCEMMjNOB6U3BXQmDCOiT7rIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383725; 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=z/vKX0PiLXjGCvEdqkokkS1I5Sj4lUSW5C1qCxm+Lf4=; b=AXazyi1kJaRN0bD7PloCjkUcBE0UdDhv3VjXiltd2LG/Cr67K8ESGRcUpR5T3qFzGrvl 2xVLoiIZ+1YQPCopLMsXZGAzwvVftNM+aHZGFmG/Z0TXCBp5F1CcugkMnafkTJa5BwyF4 sEgiXdOWP1x5bGeVIpSgid43tyi85KGS4UgBzjBLRzPjZ7hK5GYvZkGKfcnRz+AASMAUB KoNREg788/P+RoUMG4Pj8dGjBr6umFGX2ElnP2lrxuEJFjjDtfA6MpcZQrhNdxZXeh/F4 LD5X1axte5PWs0rKYkwVTa27cynrDZdoxN7Nsk8R0yWiKqeZnTNhkHFgJrPG7gQzyGg== 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=vuwbuw5H; 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 CA207606A68D; Fri, 4 Dec 2026 11:28:45 +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=vuwbuw5H Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C1D1F00A2D; Fri, 4 Dec 2026 11:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383725; bh=z/vKX0PiLXjGCvEdqkokkS1I5Sj4lUSW5C1qCxm+Lf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vuwbuw5HqfLZXDPa1s6rUH1iET/Pn8mpk5X3Us2cXcZDMRUOZ2uQTykFyHCdqOzB/ wwf0iywqjgxP6r+3Y5eLdIz1rXrCQjEqVnpg+zIccge/0QrOEoqnkSjYaxROE06ZU8 DNyXRJyDPFtxedlKA+bzQx2w9EvaUcObXAaw8kvo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zack Rusin , Maaz Mombasawala Subject: [PATCH 6.12 344/555] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Date: Fri, 4 Dec 2026 19:06:27 +0900 Message-ID: <20261204100623.126890063@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zack Rusin commit 05ee42f3dd5484415fac587d0efb8fe846b74c2c upstream. vmw_host_get_guestinfo subtracts the two-byte reply prefix using max(reply_len - 2, (size_t)0). Since reply_len is unsigned, a one-byte reply wraps to SIZE_MAX instead of being clamped to zero. The subsequent copy can read past the host reply allocation. Theoretically malformed host reply can reach this path when the driver queries the GuestInfo parameter used to enable VKMS. Check the reply length before subtracting the prefix so short replies produce an empty payload and cannot cause an out-of-bounds read. Sashiko reported this while reviewing the i386 hypercall changes. Fixes: 89da76fde68d ("drm/vmwgfx: Add VMWare host messaging capability") Cc: stable@vger.kernel.org Closes: https://sashiko.dev/#/patchset/4ab10678a8f50053934b62b56af81f881c1d3798.1788414669.git.zack.rusin%40broadcom.com Signed-off-by: Zack Rusin Reviewed-by: Maaz Mombasawala Link: https://patch.msgid.link/20261029215738.3010276-1-zack.rusin@broadcom.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -431,7 +431,7 @@ int vmw_host_get_guestinfo(const char *g /* Remove reply code, which are the first 2 characters of * the reply */ - reply_len = max(reply_len - 2, (size_t) 0); + reply_len = reply_len > 2 ? reply_len - 2 : 0; reply_len = min(reply_len, *length); if (reply_len > 0)