From patchwork Tue Jul 4 05:55:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9825745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4E9EB60353 for ; Wed, 5 Jul 2017 01:18:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24CE822AFC for ; Wed, 5 Jul 2017 01:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19D3A2623C; Wed, 5 Jul 2017 01:18:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A57522AFC for ; Wed, 5 Jul 2017 01:18:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A128789E3E; Wed, 5 Jul 2017 01:17:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by gabe.freedesktop.org (Postfix) with ESMTPS id A5A5C6E2D8 for ; Tue, 4 Jul 2017 05:55:34 +0000 (UTC) Received: from localhost.localdomain ([92.140.162.63]) by mwinf5d26 with ME id gVvK1v00B1NNgNs03VvKTS; Tue, 04 Jul 2017 07:55:32 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 04 Jul 2017 07:55:32 +0200 X-ME-IP: 92.140.162.63 From: Christophe JAILLET To: daniel.vetter@intel.com, jani.nikula@linux.intel.com, airlied@linux.ie Subject: [PATCH] drm/i915: Fix an error hanfling path in 'i915_gem_do_execbuffer' Date: Tue, 4 Jul 2017 07:55:15 +0200 Message-Id: <20170704055515.2394-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Wed, 05 Jul 2017 01:17:54 +0000 Cc: Christophe JAILLET , intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP if 'eb_create()' fails, we must release some resources as done in all other error handling paths of this function. Signed-off-by: Christophe JAILLET --- This patch is just a guess based on surrounding gotos and function names. (i.e. 'get_unused_fd_flags()' and 'put_unused_fd()') --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 9337446f1068..0746b352f820 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -2180,8 +2180,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, } } - if (eb_create(&eb)) - return -ENOMEM; + err = eb_create(&eb); + if (err) + goto err_put_unused_fd; /* * Take a local wakeref for preparing to dispatch the execbuf as @@ -2340,6 +2341,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_rpm: intel_runtime_pm_put(eb.i915); eb_destroy(&eb); +err_put_unused_fd: if (out_fence_fd != -1) put_unused_fd(out_fence_fd); err_in_fence: