Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1965534pxb; Thu, 16 Sep 2021 21:48:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtnkekjCV7npVmD4SblyN6tSJkG09xv0+T04XL9KuDsCAa3D9eYdI+D1COeM+Zap7aT7hB X-Received: by 2002:a17:906:150c:: with SMTP id b12mr10133667ejd.275.1631854137728; Thu, 16 Sep 2021 21:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631854137; cv=none; d=google.com; s=arc-20160816; b=cJhFM+oa/tGNlGueQuvb7oh4xYvrs4u0bi8F5I5i5sR4FVW0wE+tRN32lPVs5aV1sV baaox9atICbwwdCbuL7o8eL/Nqr3zfLJ9bnGL56tPVXNlE0bOYnnph4eMllgpjXeS/AN QTI8D7sXRIwq+ceyQ+ifE+Bn+ukaJOoDMb6TFva6De+LEmVjGTEAOGTJbNLUlDnZAhKY zFlzAHydqK94JdyQD0F3uPXYM2K8H9qa31590T4AJxfvfNe978B1RRIrpXPPvIjg4BYw WJiz1jKKJvxIzmeC1lsjFDAIoDlWMec48AE70+e+Ql7yBZ3OZCaoStrah2umSmTrMs41 PjhQ== 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=eNF7WxgSle7QyqeySaOCM9jx694kRGaa/Vgm+erdbN8=; b=SwLf3ZLrL6XBsDAH1/W79MnRvOiB23Fpr5rapEsEJum0O0mW5Yj8k8weBfXRifhZll +qs5+L4qimyTK+dAAikSQDL+t3BShHN5HFkJfDuz9/DRfx/2bIxGLrxPlDgrVQShoXJL xSkRudWhN9J1QPNDMjmVCbTbmdyrofuaa4Wv5omlGVWZLHM18nvGyLHxJ5w8xy4Lgtdq C3x1v66pn81J7aC+j3+DneELbs1MoOhucPmij/MZUgki6JX/H3WEkZ/+hYl3RYLYr9c/ 0lVDFRA67pbidx5wKyt67pip/bcfW1XmE0BN56dvh14fztUGDUeGV36ddQkdOBeOLY95 f6aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQqt6cud; 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 u4si6509917ejt.53.2021.09.16.21.48.33; Thu, 16 Sep 2021 21:48:57 -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=cQqt6cud; 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 S1356629AbhIPRuf (ORCPT + 99 others); Thu, 16 Sep 2021 13:50:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355632AbhIPRly (ORCPT ); Thu, 16 Sep 2021 13:41:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0B2261AA9; Thu, 16 Sep 2021 16:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631811206; bh=xJKLNwkXxe+yWlS154RS2uNo/ht2Dtp2JHLVSCIrnxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQqt6cud4oBIahl1pyzFRELkFC4HRJKEZjWaPWdCPaT0O27dpHH6ZEH2vcPe9xcHd LE2GnzE1N/WWk56UxhVrWwsPaUKSX4n7UWaCvoT4T68rzl1tT1cf25hSrssVxPbn8t DOqLrIYkDh2eiSePkQsPPOcVPxJUZ7DS1Lzt/QZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xinhui pan , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 5.14 422/432] drm/amdgpu: Fix a deadlock if previous GEM object allocation fails Date: Thu, 16 Sep 2021 18:02:51 +0200 Message-Id: <20210916155825.138039156@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@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: xinhui pan commit 703677d9345d87d7288ed8a2483ca424af7d4b3b upstream. Fall through to handle the error instead of return. Fixes: f8aab60422c37 ("drm/amdgpu: Initialise drm_gem_object_funcs for imported BOs") Cc: stable@vger.kernel.org Signed-off-by: xinhui pan Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -341,21 +341,18 @@ retry: r = amdgpu_gem_object_create(adev, size, args->in.alignment, initial_domain, flags, ttm_bo_type_device, resv, &gobj); - if (r) { - if (r != -ERESTARTSYS) { - if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { - flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; - goto retry; - } + if (r && r != -ERESTARTSYS) { + if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { + flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; + goto retry; + } - if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) { - initial_domain |= AMDGPU_GEM_DOMAIN_GTT; - goto retry; - } - DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n", - size, initial_domain, args->in.alignment, r); + if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) { + initial_domain |= AMDGPU_GEM_DOMAIN_GTT; + goto retry; } - return r; + DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n", + size, initial_domain, args->in.alignment, r); } if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {