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: 9824137 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 C3CBB60353 for ; Tue, 4 Jul 2017 05:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6F4626E74 for ; Tue, 4 Jul 2017 05:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB52627F98; Tue, 4 Jul 2017 05:55:37 +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=ham 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 1B80B26E74 for ; Tue, 4 Jul 2017 05:55:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C54026E2D8; Tue, 4 Jul 2017 05:55:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 A66D06E2DB 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 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 Cc: Christophe JAILLET , intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/i915: Fix an error hanfling path in 'i915_gem_do_execbuffer' X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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: