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=1796380747; b=wii0zeDbxzSQC1jnpouPBQ+OFnbwb01VezixchsrcGh/z62mwvYcC7371QzyR4Ovvuh3 NEBtuwrek/U5Jbnw2yCE3eOdnY77x10tz7mNHFO5U7TLm81aClF9LqhE6gwHTGw880C+D MPH5OkmF0oBn9yYFkhXFwzdq94XFPzn0g0QSqYf5FlKeMYw81xnY1JStGXufB1GSrJVNy J7OL4qhloVvRaaWYui3Gwg0TVS+0QrD9yYnojptj9jCW+I51/q5OsIXdyCdaVraCW1SFk 7v/HSqZGznXbZ+KfyHa5fInJ17A+Izi4BomuUTyhp7N+RfIYDKPRwiSspFFmSEDjjXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380747; 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=qGEhKkQ90n3b9jBAMHu0PEkOYK4yqcgiVmfN8urKfH8=; b=5j2T5mY8jo4ZkAPn8vq3YfusxyyFOn9AB7vzQxa6K2BxqzL73XF38IoobjsHo85pYktZ TQkUksiJSlvgbjtEMBSwAyVOXcXe/y6gEuxPV9ztiDxdvu7yKAu9p5XNnNru49WZis/Rc QwGKpDF8yHzaIP+PiN3UzCOH/UbYNoB6syNMkPhTyMjeDkKxn/OMZ+2lYXjRq5QI2ECaf urk0tfwUTHf04KEBZ3g756+ujzlbiPFrMKUsZNvYKOfBZdyJB9X35vYPSp18OjP7hipbE 0EhPZXMrJDM5aIxxLLKQSxwc5nZJ6JjwAuPGWEm7QuCCz1KJk49VnK18+xUiRnFMZ9A== 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=U5pr1Ucb; 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 5CA71606A322; Fri, 4 Dec 2026 10:39:07 +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=U5pr1Ucb Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB4F1F000CE; Fri, 4 Dec 2026 10:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380747; bh=qGEhKkQ90n3b9jBAMHu0PEkOYK4yqcgiVmfN8urKfH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=U5pr1UcbQIN7sEw2bY9a0Oh+tiilENUfIgI5c5xCN4DC/ooAUXTiY941mjEahawtK cBOfubi88JIC8Rigrc51CcUbpTSVwUN9jcqx/ZuhxGXDeyWkKETy+hDxNHtUW724Z6 Xwhx6iTgbcIVtYpo3u6cW3DZv+E6qd8CasDE7b4A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zack Rusin , Maaz Mombasawala Subject: [PATCH 7.3 408/742] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Date: Fri, 4 Dec 2026 19:04:32 +0900 Message-ID: <20261204100645.933979070@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: 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 7.3-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)