Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483870pxj; Mon, 10 May 2021 04:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7JvJLKcJjgICwmHoZq0k6b/j9fPohxmt3gePK8ozb/0tkwEHiWJKBrLunfC1T+n0p8i5v X-Received: by 2002:aa7:c610:: with SMTP id h16mr28352836edq.202.1620645122298; Mon, 10 May 2021 04:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645122; cv=none; d=google.com; s=arc-20160816; b=uikqM/kcwBMZe2O9T40n7G56ZMDR3JNtqS5LfUCr1EC6ydqHU0VRSDqBb0V+faEcej FuW4/XpmGBK5A2cd3lDf5b8pgNmDoP4IE3a4Hn17A++ZL+L5Y58axnErKWWquVVo9vQl NG3VRfsR/tmgXldKDKn6ilHul6kW27Vn7ykkIxzIhWIx5md7H6aSZOL0TDLU3ir1aamn KH6yo7ylUSNRbBBwBdE0InRsv8jVom06TMldKQ5DNfa8I1dCF+kvKppckyoCFSRYlkVc ls0e/O8QsvZ4a5Wl49VclqRZGLr0vTHqC6PBJl4OW0vwP15QpTdhrqsi7U3j5xFfmZP/ zPYg== 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=YVVj/hZo5ynK15AGdxWgyIbn7lopRVXHg8md6AZkKGs=; b=A/3vciIwnZwhE6GtBiUWUgBapw3GEtczvpI0Z6SzMwsEmc7u340abl14e7PMlVbFTb 79W4GPINZfVZ8F+K2BetID8uTmH3/vn8HJbG1qkxcSWE225tja+dW8kTDEvFKph2mzaV Go05kiJKUHrnxTlUGlnFwaEugp+sdT3TkytJ6ftt6HZN3XzYD23DLuzIzk4eS8xQeF7T 3zkEbvO1atHp1ruRIU0QrJhhsQEbtIpbcc1Ss01kWss6d1sA78QYeIXAkN4hYqbRuZVG 0iZLcy76OFWhfb0AbmeEcDlBPegTNdzrjcAfDD6LkJ89A9Wh7D6t0bMCfnPMVgvoBWfy Bo4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cr1gYvFr; 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 w21si399285ejy.240.2021.05.10.04.11.38; Mon, 10 May 2021 04:12:02 -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=cr1gYvFr; 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 S234994AbhEJLJ6 (ORCPT + 99 others); Mon, 10 May 2021 07:09:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233443AbhEJKuC (ORCPT ); Mon, 10 May 2021 06:50:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B9004616E8; Mon, 10 May 2021 10:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643130; bh=xuaQyowJnAi9b6Ss3OrZfWGSxAGyrYu9Gkf8tyxhaX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cr1gYvFrBT1/W0hZPnIIZGP3XWRxeP9WvOCFaVS7RgMQkWyHvStfsxcJRCsM6pu0W GiN6WP9ouw664D/WlZ7BBjU/aPFc0UyQaX4VScXBpgPpeIFd2w0zyD8DHh7DcOoshv UcBGtEUZwQqtL4cS8EpdwEs/MnDxbIClBTaDj9hc= 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 189/299] drm/radeon/ttm: Fix memory leak userptr pages Date: Mon, 10 May 2021 12:19:46 +0200 Message-Id: <20210510102011.190492536@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 5aeaa43e0ef1006320c077cbc49f4a8229ca3460 ] 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/radeon/radeon_ttm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 36150b7f31a9..a65cb349fac2 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -566,13 +566,14 @@ static void radeon_ttm_backend_unbind(struct ttm_bo_device *bdev, struct ttm_tt struct radeon_ttm_tt *gtt = (void *)ttm; struct radeon_device *rdev = radeon_get_rdev(bdev); + if (gtt->userptr) + radeon_ttm_tt_unpin_userptr(bdev, ttm); + if (!gtt->bound) return; radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages); - if (gtt->userptr) - radeon_ttm_tt_unpin_userptr(bdev, ttm); gtt->bound = false; } -- 2.30.2