Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2917461ybx; Fri, 8 Nov 2019 11:14:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyh/I2bF5x6afHUddHJgPZiZApJ2C4xbRsMEVTEI8e5yhk9p/6qZ7in95XqY+fNHfSqNtrt X-Received: by 2002:a17:906:4d93:: with SMTP id s19mr10444913eju.285.1573240493388; Fri, 08 Nov 2019 11:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573240493; cv=none; d=google.com; s=arc-20160816; b=XL3SsXEizpQlOESODlC17UqnfiMIbVtht233WrJ7etWEaMbhyDMMF1xa901mvWrgjL eXaUKATie/4/9UQYVGsvB4Tts2J/5q7zXLkAVD7VEbuAFzJQCQhLES4PbHmGM14XZy2u zajwp40XAi+73tp1PIaw15R7lOn737FfInuYmsMn//YsQgFOyvGFeQkPs8wdEnZ5Gs14 iV4PVCYw2epfX1pOakeR+G+YR6JBe4WMZjEkd8onvmNulWWCYfcphscICVE1zpNOMka7 UsQQjp8MdfQe/jVBJZ60AuT0DB3vS0l91Pc2l73OBvyA+SJ/3psk1Q4zOELMUFxSRt23 hg3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J1Hb5l30clwYc5eFaHRDJfZx0mKQj0HXQFfdO0iA8JE=; b=kFo6BdDpfQ5j/JnHlyBC8/xWNd0PP8zhpLtfCV1UQtZoCHiE+P+P8AeMaq8iHqSp6A f3dHiNu7IBctzCq9VmSsioAWMpOe/qZGy2CMc9g8jLc7OpM4pVi8dq+fOXS+CXwHxBDp 9EvQVfe9du2dtSV2VRdOAaXoV8ocADu5DFtzz+viuGvYwwDhu0hVC33i92Zigj4aeiSB cdhXTXV+VhF+n/wCHZDM3grD/PDbFBHwizhdBx3phE2/9hpRm+UrYm0IQFnsq30PTnZT KdxzhWEYF9l0qre7qsc0AtPBGaVvwJqS7nUTJDeyDsUHvf2HwneHYd/3Htip9u3EipWK JSqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t7p25BBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28si4870149edb.10.2019.11.08.11.14.29; Fri, 08 Nov 2019 11:14:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t7p25BBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391341AbfKHTGs (ORCPT + 99 others); Fri, 8 Nov 2019 14:06:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:37324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733176AbfKHTGq (ORCPT ); Fri, 8 Nov 2019 14:06:46 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30FA320673; Fri, 8 Nov 2019 19:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573240005; bh=RoOwuTEoleM5cqE4Jh826MjpsBVUMzm5KeiWX26H0Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7p25BBWs3WMN27yLIpsy3CTSCoTxFZ8nm7Oli/555NlK81vmvi6ZnMMmaucuxmGu 6MAkRyGORsUEES0nNKr75DxHNhee8KUMAsk+FHJJoIk8SyD520IPBcxBAsADpFJsoo Xg5fPs1ZR1+IOjvKPAlpTEDjGzNSlwxXdNv2plG4= 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?= , Huang Rui , Alex Deucher , Sasha Levin Subject: [PATCH 5.3 055/140] drm/amdgpu: fix error handling in amdgpu_bo_list_create Date: Fri, 8 Nov 2019 19:49:43 +0100 Message-Id: <20191108174908.790526222@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174900.189064908@linuxfoundation.org> References: <20191108174900.189064908@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian König [ Upstream commit de51a5019ff32960218da8fd899fa3f361b031e9 ] We need to drop normal and userptr BOs separately. Signed-off-by: Christian König Acked-by: Huang Rui Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index 61e38e43ad1d5..85b0515c0fdcf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, return 0; error_free: - while (i--) { + for (i = 0; i < last_entry; ++i) { + struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); + + amdgpu_bo_unref(&bo); + } + for (i = first_userptr; i < num_entries; ++i) { struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); amdgpu_bo_unref(&bo); -- 2.20.1