Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483528pxj; Mon, 10 May 2021 04:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCuDa5Eq7fhiwT2GHqQQcIOkOhmng2ZubhnCl12UtERO7w9d9WXvziG3ea+VhvDaIP7ZgE X-Received: by 2002:a05:6e02:1b0f:: with SMTP id i15mr2632903ilv.164.1620645090835; Mon, 10 May 2021 04:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645090; cv=none; d=google.com; s=arc-20160816; b=s62PX/ASfH7X9e35f5mIzcXa/gJyNEgLDFQF/uyg4sC3QzKbRjTnTy0CsmVtzeFYuE hpWWQxoQMicw5/M6MPYPXQfh/E9GrN4B6N1COy6DojAen7CFAW/q0fnPuUlpIMbxnOpM 9tyc/+zA6MTmL/tnvkUdZT0dXWzZuZhGyyM2hhTA5DmVKUdgcaBBj2VueDe2GHrkEd+u K/Y0VMMeADpKDU/D8Tzd5i8ZWM9FwyjwQFDUFBK+XozLNnO3Gyvvo8os2+JIZSqxjPl1 kmlk3EF4YqOYfPxWezD9Ryw/3H77/JiuH23m8480KuDSWBL6zvjpcjnyWRu3RxbkOAS7 sHHw== 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=GY5dUOKq+ARKlblQqjdGG1BZKCLUD1ddqsNtcIcbxic=; b=TNFZF6x6vceXVE+XiO9tcXQducurNwM10/U5lWJcoz9ds1A8b2GNqk3tz39z2t1Vel I2YjJ7+u9aTvclHlCjvccadfAxVskpPgyJrf7DzFK2eqUMnKIV+/lj6MTNQ63YZDLGnC MkHgRdGw1O0a3UJPTj7bPvUer9TFtoqki3G/iw4/AAH+Q7POhIcsZDAFmfoQaL4IseAP mvJOU1X7i7Ge34Zd29qoXlWUo8TfyGjLMJpwR+62fPqQLBulsbKRK2pePek3BRU0SqAP DrqAy9UDDOK02lVhG7CxwT9hLCBzGjZUdHPEIzjDbpHGS8qF/FrRfGlaZvM1d4w0PiQY uqoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fEuu41wy; 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 x20si15365777jao.3.2021.05.10.04.11.18; Mon, 10 May 2021 04:11:30 -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=fEuu41wy; 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 S234908AbhEJLJs (ORCPT + 99 others); Mon, 10 May 2021 07:09:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233425AbhEJKuB (ORCPT ); Mon, 10 May 2021 06:50:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F00C619CE; Mon, 10 May 2021 10:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643127; bh=SZIz/g0o6vrwlXyk63PUQIv8XnYxuFtZ1b3aLMhAlRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEuu41wyU1U6lABPN0LoDRVBDkTNF9delGxj969FhsmSUR1teXWVy8kpsu32YNNU8 Eqc9h+S2Y3qZJEcMRnjHQHHLnAnKNl8z2jxj+0n8pyQ+WculwEV279BDx+jFbicffo W6nmIdV+4LayLt12c26j3281lKreaacMDY9LuxxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Daniel Gomez , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 188/299] drm/amdgpu/ttm: Fix memory leak userptr pages Date: Mon, 10 May 2021 12:19:45 +0200 Message-Id: <20210510102011.159599673@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Daniel Gomez [ Upstream commit 0f6f9dd490d524930081a6ef1d60171ce39220b9 ] If userptr pages have been pinned but not bounded, they remain uncleared. Reviewed-by: Christian König Signed-off-by: Daniel Gomez Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index a0248d78190f..06a662ea33dd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1254,13 +1254,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev, struct amdgpu_ttm_tt *gtt = (void *)ttm; int r; - if (!gtt->bound) - return; - /* if the pages have userptr pinning then clear that first */ if (gtt->userptr) amdgpu_ttm_tt_unpin_userptr(bdev, ttm); + if (!gtt->bound) + return; + if (gtt->offset == AMDGPU_BO_INVALID_OFFSET) return; -- 2.30.2