Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4587204pxb; Thu, 14 Oct 2021 08:06:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvXpRUcIFPidcEu3sS11bDbvXuS4If6lQYZLEQjUeLf16TjJT70Op0IHagtWg9izd2jhJX X-Received: by 2002:a05:6402:26d1:: with SMTP id x17mr9398581edd.367.1634224006170; Thu, 14 Oct 2021 08:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634224006; cv=none; d=google.com; s=arc-20160816; b=CeunaXg7ssA7qM2XNxfZAu5Fw6PB2mks8WOGJIGdN+2xWWiQF1Yaq5t5sQn9SjDJyE UEd46I2svxor2iT70GxwljqV2FgAMnLUG9Eabntq+mJcAiKMag6WIDBhrz5n/Wz3OYq3 OOV0uwe4s/glZyRfr6wuCkZTNnZbDq6g70Y6UlnKDOu5fgxXx7wyLpcY4EsFv4rMoQTN B4pZIr3LHWw4NDNEHu5lZWMKokYSAj5v8uIyYMmG55B6w/X3C2Qs+lkBd4jaFwOi3+yf SJrdkWEUA/yEE3nJ4kkxVQMXWihNecFCeAzPpdYYuAikw2HgQqGrQO0NOhwM8g2uFAtd paqQ== 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=1HmKgtZN7DEvafM/Ph0/Fo/rXAlgloYTwtxAeXTCNlY=; b=YG15c8UOWyaNG4QMljFGMCxVIJhA9yeV3Rw3AS/yDm0N+UrLI1I6EM0ezcEZPLoGgU ABt+dmzOxsltL0Rn/R/PGcoEsBJ071syM6axOs2LCfgwRrN3otwOVVzvmSxqsCthaKZI p51ZMh8b17lnitZPVGNTp4shc374HRAoky0aPtKmXqXK0OCev2Ycq3yZf/GnF1wbOQ+I OW+S6rdL8Q1XLsIOvPLq4iy8cPjgFxLaaZhYuBFE4Upr3Tmi7L4pQT39pzvCOU4ZTr+e eTQ8oZlVd27uXGAZniqJyR0uHn/r4euVl53HMrXM4hyNdoERrujFjD3aM/742mBgx5eB umIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMI5wt8J; 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 x12si3948787ejf.380.2021.10.14.08.06.17; Thu, 14 Oct 2021 08:06:46 -0700 (PDT) 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=vMI5wt8J; 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 S232003AbhJNPDF (ORCPT + 99 others); Thu, 14 Oct 2021 11:03:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231683AbhJNPBj (ORCPT ); Thu, 14 Oct 2021 11:01:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B2CB611C5; Thu, 14 Oct 2021 14:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634223539; bh=5dmm1Ef3IOZdp+QCshrZDWnytx8HgMKMx14U0hnogMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMI5wt8JkHi2nRKTpjFU+f0tPO7GI3H9XIcbOKjzyEiQP7dVIzqF5n0fPHgbSS/qq JiG7fHsDTlRhpj1bwR6ZciShr8fT3x2x/62uj7YBxwhYi3pyC1v/T0m8OB7paFfF2e 0ZjmU4KCelihjZF4GU2h8g3hE4Sksi7C+lnefN1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hawking Zhang , Leslie Shi , Guchun Chen , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 13/16] drm/amdgpu: fix gart.bo pin_count leak Date: Thu, 14 Oct 2021 16:54:16 +0200 Message-Id: <20211014145207.745121194@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014145207.314256898@linuxfoundation.org> References: <20211014145207.314256898@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: Leslie Shi [ Upstream commit 66805763a97f8f7bdf742fc0851d85c02ed9411f ] gmc_v{9,10}_0_gart_disable() isn't called matched with correspoding gart_enbale function in SRIOV case. This will lead to gart.bo pin_count leak on driver unload. Cc: Hawking Zhang Signed-off-by: Leslie Shi Signed-off-by: Guchun Chen Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c index f642e066e67a..85ee0e849647 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c @@ -903,6 +903,8 @@ static int gmc_v10_0_hw_fini(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; + gmc_v10_0_gart_disable(adev); + if (amdgpu_sriov_vf(adev)) { /* full access mode, so don't touch any GMC register */ DRM_DEBUG("For SRIOV client, shouldn't do anything.\n"); @@ -910,7 +912,6 @@ static int gmc_v10_0_hw_fini(void *handle) } amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); - gmc_v10_0_gart_disable(adev); return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 688111ef814d..63205de4a565 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1526,6 +1526,8 @@ static int gmc_v9_0_hw_fini(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; + gmc_v9_0_gart_disable(adev); + if (amdgpu_sriov_vf(adev)) { /* full access mode, so don't touch any GMC register */ DRM_DEBUG("For SRIOV client, shouldn't do anything.\n"); @@ -1534,7 +1536,6 @@ static int gmc_v9_0_hw_fini(void *handle) amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); - gmc_v9_0_gart_disable(adev); return 0; } -- 2.33.0