From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E706184E; Mon, 1 Dec 2025 11:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764588729; cv=none; b=UgnIdbMIUM2trR268GFgdT5QNa2fP2LpNeGhNJt4xke7SnoMBi4NeaO2tV9VL7tBwFIlltxYLUs0ovMZ5FHkz4OcMf/3nxX3SnBgk2Hneq6bFgMXRxxB1jiQhp58Bkr5pcvZ2JGA9Pj2cr4hjNMU4K4aW9RecKX8qC5m5MRKiCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764588729; c=relaxed/simple; bh=lizZLlKIUxOJUsavlh394sd7g2d9XPxGQWSS8MEzVPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AKayA1UfWba5wWVDkalqGlkY0QwncYG/1nNTaLcVEd1z6eKUiSTuJazwuM9wM2I8iflVtKCfIMUp6T3ndATFMfbJQTY/I9D5eCbcWC7cb3WoQRPYzcTXAABnZW9yPGS/AVHVITr0TCKnDAnUXe+3gEnvk/gFG3QbsyPxgRb/M9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ujljiCDW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ujljiCDW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06C6CC4CEF1; Mon, 1 Dec 2025 11:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764588729; bh=lizZLlKIUxOJUsavlh394sd7g2d9XPxGQWSS8MEzVPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujljiCDWKEqyUjMfGXwciZWdeMYkjFiGugCHTdVvAY1/Yu49HFYYlK+E0zhhIJS2H Awg+gntznQ/HxNeXqKm9ciIE71jLkTb747lcpcRWp1z9f6ykFYq354+T+MVM/DMM+V x445akqPusQ9uTFRj55zhD/12fLbQT131C+UflAU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rohit Keshri , Ian Forbes , Maaz Mombasawala , Zack Rusin , Sasha Levin Subject: [PATCH 5.4 149/187] drm/vmwgfx: Validate command header size against SVGA_CMD_MAX_DATASIZE Date: Mon, 1 Dec 2025 12:24:17 +0100 Message-ID: <20251201112246.601524588@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201112241.242614045@linuxfoundation.org> References: <20251201112241.242614045@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ian Forbes [ Upstream commit 32b415a9dc2c212e809b7ebc2b14bc3fbda2b9af ] This data originates from userspace and is used in buffer offset calculations which could potentially overflow causing an out-of-bounds access. Fixes: 8ce75f8ab904 ("drm/vmwgfx: Update device includes for DX device functionality") Reported-by: Rohit Keshri Signed-off-by: Ian Forbes Reviewed-by: Maaz Mombasawala Signed-off-by: Zack Rusin Link: https://patch.msgid.link/20251021190128.13014-1-ian.forbes@broadcom.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 0d29fe6f60358..d31e9d380967d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3216,6 +3216,11 @@ static int vmw_cmd_check(struct vmw_private *dev_priv, cmd_id = header->id; + if (header->size > SVGA_CMD_MAX_DATASIZE) { + VMW_DEBUG_USER("SVGA3D command: %d is too big.\n", + cmd_id + SVGA_3D_CMD_BASE); + return -E2BIG; + } *size = header->size + sizeof(SVGA3dCmdHeader); cmd_id -= SVGA_3D_CMD_BASE; -- 2.51.0