Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp631493pxb; Tue, 2 Feb 2021 13:47:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEZApsp4tKLXsyAc/1MRHP/wtRTo5L28v/VyuNCQDEALxlL4W8PxMP9grvYhCiDoM6aW6b X-Received: by 2002:a17:906:694c:: with SMTP id c12mr43340ejs.358.1612302437732; Tue, 02 Feb 2021 13:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612302437; cv=none; d=google.com; s=arc-20160816; b=I+kl0xpMG7nzwvEGeU/+JBX4X57zbxewyOPG4fGpqlpxXlvBZ2Z8oNH60dYFE3ng6f icteypawd61ugaF++HD8qRyjiv9UL1EnVy/vsfLaCr66GR5vj1+k/IQua3xiTVL0pVQN aGGzOlhpBi53W/CZa+rUZ1NA+H2XIIJUcJo2PVPbil8N2x4YiCot4PSf6aE78TEWYD1N ReHdsnOV0v5JB6stCb65f/YGAYCF8QuEy7BcT1oJDo/2iI886+/APSVxfsSyB5xaESyM DmnYUo+kPQk15jwg98+3P2vI8zfWUJiXFQuifC9UBcMzSKc+u0vTfmOgJJnnC2EbFdqU Xf/A== 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=xqXBE9VWC0CtQ11zHXsvGrT4xTzdzrVaDnQzascXDkk=; b=RwixPBTE5U4M2hViWs+h1LGa/G+PVhkwxp6W7MfYA0LRV9lCIGLZQw50a15ihb4EZx TJGxiJR3wPjCX4samh1iW4fuE3c/i1e9RLc2RlQqu6GNCK2WrIyg5zUPUEpE/57GHP6F IUHgWpDCAr6Sh0v0H22ZPYDK0cm3MhxIXAlgOEg+UOyWhxZtOSY76tsh4dWFcVXIF1Wo Hq1RGH+C4nfsel6iUxkjQRfXg8NglRIoSLEeRPbcF1ySxKr/TU98ApAj8TK7I/9Q+uz2 OGfAscTFafiCQI/mc0U4+zma1lXnG639PkAenMMPgEWrLOE/uCb1vE1+UPOoH/f2bnmS TMTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zfFN21vl; 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 o13si4426edq.184.2021.02.02.13.46.53; Tue, 02 Feb 2021 13:47:17 -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=zfFN21vl; 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 S233287AbhBBNxi (ORCPT + 99 others); Tue, 2 Feb 2021 08:53:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:38094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232742AbhBBNrY (ORCPT ); Tue, 2 Feb 2021 08:47:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E33A864F95; Tue, 2 Feb 2021 13:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273312; bh=3tsrlpPeSYjCRQFX/Kko3V86vLDgJBvIC0KszJLfEng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zfFN21vlqYW0ZeEBk0WG484L7DVlBlYftEG/COh/WIHd6Hbzsd5tGWWVQbdkUw4k0 XIFxGHZNTASpGg5S+uiHA1Ngwo7EJliaUU9ay+Y2TJdvtAbnUVEXX+9uZKBdIZcKva nwxnlhNMhgSrazAY5GLxcTVhRUqs7laZc1rPOICw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karol Herbst , Ben Skeggs Subject: [PATCH 5.10 059/142] drm/nouveau/svm: fail NOUVEAU_SVM_INIT ioctl on unsupported devices Date: Tue, 2 Feb 2021 14:37:02 +0100 Message-Id: <20210202133000.153752372@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Karol Herbst commit dcd602cc5fe2803bf532d407cde24ba0b7808ff3 upstream. Fixes a crash when trying to create a channel on e.g. Turing GPUs when NOUVEAU_SVM_INIT was called before. Fixes: eeaf06ac1a558 ("drm/nouveau/svm: initial support for shared virtual memory") Signed-off-by: Karol Herbst Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_svm.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -315,6 +315,10 @@ nouveau_svmm_init(struct drm_device *dev struct drm_nouveau_svm_init *args = data; int ret; + /* We need to fail if svm is disabled */ + if (!cli->drm->svm) + return -ENOSYS; + /* Allocate tracking for SVM-enabled VMM. */ if (!(svmm = kzalloc(sizeof(*svmm), GFP_KERNEL))) return -ENOMEM;