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=1796386522; b=Pcgd2ZOOsLqWhXp9ue4FuSu21qHs8u5zKBqZVr+hYqO8jgJTycHhE7wDU//sdy11zbqU yF5m74oEMZfXDfoRSRSBTBblSKX9AruSVx40F22sndT+UyyVSjEqljYG1pVoN/jmx+ipE QknVjrvFqXPZM747AcpnkD8M4kuL1S3jepUhAXsHpmuUILpbIdtfSYK6UVsukCOlZlO/0 mgv1BTy0H2JTypeQ3QdrqnbLFIJqzQlCq5/Uwnxkeo92lcXiaWe099fWNCk4KPJFyN2nY KzS9hjFpdK5DcRdoLk3Vx3RAXCYez9T6rIn0xd1+OB+pEeWsa9GeFzq/bbofaLeerSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386522; 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=ELNy4pdJ/RYmOHxDppDYoDJPctdfOVgQseAfH7QUNu0=; b=K2SO0SJJtRN44JigZwkTzwnDmbmDfh2PNaLODYPTgQBut0iCQQR0IqmUW2F9VNTcMakX fdtCTbRUMJl+px1AahyVWBLyFYAF7hn0q211g4DOUsKXUMN5sYDQQS7uY2OEjyLGpIuJA jshWuU9CvkgB30KXFGWK1G1n/lYYYM0wUVxla4Ro2XITqV8Hh95TV307u9VipjDXSwiMB n3TuW0itnided+CHknP7HN6fsAGy6BEK5uxh7grw1S2XcZIczwlgcFpHjzDNiHlEeU8GW Gw0XzJ+h/j2WrhykD0cSBFnaNimVWhjGja9LApbjUt0V0gZJuERyVxhAxDrkYkqookw== 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=a9JgpMic; 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 303DA606A322; Fri, 4 Dec 2026 12:15:21 +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=a9JgpMic Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F9F01F000CE; Fri, 4 Dec 2026 12:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386521; bh=ELNy4pdJ/RYmOHxDppDYoDJPctdfOVgQseAfH7QUNu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a9JgpMicxSo+67vG4BliDv1KDgZ9FhkjAj88gSAJHAA9UtH4JKLRdP39KMQ/OxJvc wdUzveVHjGjfsMvb8MqF9ET0lN/XePcP7yDADy9zT6/hGelqTOXfWbzt2Phk1sJ+Lr 05QmNKZg+gF6TTsP7OckZXT0OrVSgc3pueb4NQ6s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zack Rusin , Maaz Mombasawala Subject: [PATCH 6.6 0999/1167] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Date: Fri, 4 Dec 2026 19:07:06 +0900 Message-ID: <20261204100728.232176607@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: 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.6-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 @@ -464,7 +464,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)