Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3976448pxb; Tue, 25 Jan 2022 00:26:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxF4SagNWgWUzRO3X8FjbEuCyKkWTfdFRGEpT06NOJpDAR9JNabAV7gcOb/x1aaFfeMfZpn X-Received: by 2002:a17:90a:9504:: with SMTP id t4mr2380549pjo.164.1643099213843; Tue, 25 Jan 2022 00:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099213; cv=none; d=google.com; s=arc-20160816; b=n28nri8rcLLoJTMfbIhv+5x4bgn2g5tagDSlcswqv+43oXWfDJ3EwLAC/lyK+cRoPF 1zKGFVhNTAZ1zVfVyuZRguyyVVleG/UWNtMmtbBu9YmqSAqtin1Lhsr52m4YvIkTWg8Y AcrzgFWwYtDQwsSJGVi87Ox0LFq9CzyKpMVDZNAhMsCkd0i/thJ+oTDNUdA5C9bK45T1 DtvvZYkaUF9z8FrHgjKyohNc8GuWxl68zPlmuUznuZ1jnUZdnsG+x6C6Q783v/qUWcKb dAqanwhGTADRWmLZFci6Rm27Age0KbO32h/zkm2WW0so4PgKqkmLeoNhmJ4bgIa8jEwF +mAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QSFfsuXhg1og8QjWamc+rVPqRM7tARLdftB+jKHLHhU=; b=FsrcznIWIj407DxnTBMQvvJayuBHt49R1SiL8CcJt5sG713H0WboehZMS4I0IDCBS5 9UbFEXJs+NKVLnRM6NAWjpTmVRr+iOJiWm3gCHyzg2dpMzd75vfDWVXaVhJ+Nl9dVvsk rUw5y23dMP7zYDtIcoW0438/qbsMoNNTXUGmKgxhQxHaD4gBSU9/+s98ZWhrgEP1LNa3 nVGymdbCegLHrcQxQDxd6vsOetQCxWzfYcgxXbFP+0zEB3JE4CmYWxoyh521S7FalPDW Jq8rmZ7lVEtubA9ofj9cpHwjMiY8dRp8KOVCfvSvrO1Xrlt1Ut1JOR46d31rhi3fAse+ x/dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OuVQYo0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mi2si1574250pjb.139.2022.01.25.00.26.42; Tue, 25 Jan 2022 00:26:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OuVQYo0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422476AbiAYCbS (ORCPT + 99 others); Mon, 24 Jan 2022 21:31:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45116 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237962AbiAXUSt (ORCPT ); Mon, 24 Jan 2022 15:18:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16F72614E2; Mon, 24 Jan 2022 20:18:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC3C3C340E5; Mon, 24 Jan 2022 20:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055527; bh=tdR6gKGncBF3HjpyNtIxUyGnEF9+TBf9ZeYEJNJWJGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OuVQYo0JdcblwU4VkhqMQBpPpYOhlIOug6j8jP019JAIF2ijaadX4mnP3A/HuQzqI +PJAPKWUf4xRMo0THIx+qByEYbpaosWhoOW9orrpJhIkaBUzNfktFGvYf5/UolqxeX b9+QfUnOd+XIwoAVNLR3c8uc3tt3SUq9tD6qYu5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zack Rusin , Martin Krastev , Sasha Levin Subject: [PATCH 5.15 179/846] drm/vmwgfx: Fail to initialize on broken configs Date: Mon, 24 Jan 2022 19:34:56 +0100 Message-Id: <20220124184107.157187763@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zack Rusin [ Upstream commit c451af78f301ff5156998d571c37cab329c10051 ] Some of our hosts have a bug where rescaning a pci bus results in stale fifo memory being mapped on the host. This makes any fifo communication impossible resulting in various kernel crashes. Instead of unexpectedly crashing, predictably fail to load the driver which will preserve the system. Fixes: fb1d9738ca05 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU") Signed-off-by: Zack Rusin Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20211105193845.258816-4-zackr@vmware.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c index 67db472d3493c..a3bfbb6c3e14a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c @@ -145,6 +145,13 @@ struct vmw_fifo_state *vmw_fifo_create(struct vmw_private *dev_priv) (unsigned int) max, (unsigned int) min, (unsigned int) fifo->capabilities); + + if (unlikely(min >= max)) { + drm_warn(&dev_priv->drm, + "FIFO memory is not usable. Driver failed to initialize."); + return ERR_PTR(-ENXIO); + } + return fifo; } -- 2.34.1