Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3696166pxb; Mon, 24 Jan 2022 15:37:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyY2kYE/vD1thL0XhCO8EQqT18kpCIznTHv42yKGOfF9xbHdyVcnPrQbPtvxZZQd1woXq7f X-Received: by 2002:a17:90b:388d:: with SMTP id mu13mr678079pjb.228.1643067450211; Mon, 24 Jan 2022 15:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067450; cv=none; d=google.com; s=arc-20160816; b=cR5XWiiNn6bbuFyT5iDs9JfVPXbtEPug4Y1H4ZkvNtMk6b0ONfkXFjCFStaYopbXFv UP7o9FeVU2XpX8v1rUkRWrHVJFTtXIKI/A3AhCbZ845vHxIgsYVrJu4InuHlggoutEz5 XkwEwdbAy+uB6iK6iyWSgQwmcTFVzwLjIqg0DJEszAekqgiZ0l2JTv+Do1XQwesMZIN0 tiyCIwZfefDYIGbEq/PMqR35sQ971Tb9DQU54o3lCtwS9kqNnTc2a3tofKCPZMqBSgCL mRt2dmsG54PJ4LHEh9LoNZtoENdIRxth/zf45GDrwftmcOKVQLZZwXDXVtUzU4c2pvDi Z5FA== 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=0zLR2icDJ7zKAcV+f/RP0TkjBj8pYpKM/CVFpmZLga1ZRITw7p86au9OyrnwUU1CLu 8A9a8TtzGHyYuMhsqj88800mbql2LqrTL2jMu7hzsAHDJ8IkuKSHU2nkcSUdGPPwVrEv VynpJB1pH4ofvNl80d6tKIPzsI51jQlKDwwQ0Hh354vVQCkoEZ0CrL6KFyWTibCgjhyR iiL+PsjfJyGpjSMqOAVnhFUMxlwDXK4Noq1cjqzrh6GnlnF/M28PgzlZkXQeLecSQg2B 58bqv+mD8ngfu5Ts6wfGpUcVChQMSbvIdjCjU1IGwfMCo2FAfaPfZRHHu60L4WEnLB1T yuJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ECPMU5fj; 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 y4si3592880pfa.331.2022.01.24.15.37.18; Mon, 24 Jan 2022 15:37:30 -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=ECPMU5fj; 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 S1851335AbiAXXc1 (ORCPT + 99 others); Mon, 24 Jan 2022 18:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356728AbiAXWjp (ORCPT ); Mon, 24 Jan 2022 17:39:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93847C04D603; Mon, 24 Jan 2022 13:03:04 -0800 (PST) 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 308F861330; Mon, 24 Jan 2022 21:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9357EC340E5; Mon, 24 Jan 2022 21:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058183; bh=tdR6gKGncBF3HjpyNtIxUyGnEF9+TBf9ZeYEJNJWJGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ECPMU5fji+WrdDHg7lKG0e8/5B4AMPJ0QfqADSom+zfv/VvRMGU20X7jG6Uh/KAUx e9Zx76ndavY07+d/U9PlW9iO+sN6S+55K/ihY1meA0DSAYlw912dkdnyawmY0GXvP/ NgSAhF24biT5DyqtBKloD//6gVqsgSwLW5migUiY= 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.16 0207/1039] drm/vmwgfx: Fail to initialize on broken configs Date: Mon, 24 Jan 2022 19:33:16 +0100 Message-Id: <20220124184132.284995393@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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