From patchwork Wed Oct 19 17:48:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9384981 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 49E8D60487 for ; Wed, 19 Oct 2016 17:48:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FD6E28C52 for ; Wed, 19 Oct 2016 17:48:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 324B728CAD; Wed, 19 Oct 2016 17:48:46 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 972A328C52 for ; Wed, 19 Oct 2016 17:48:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 547C26E990; Wed, 19 Oct 2016 17:48:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk0-f66.google.com (mail-vk0-f66.google.com [209.85.213.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46FE66E990 for ; Wed, 19 Oct 2016 17:48:40 +0000 (UTC) Received: by mail-vk0-f66.google.com with SMTP id 130so1486359vkg.2 for ; Wed, 19 Oct 2016 10:48:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uXbywF2fSiXU60vpT+Mf+PEo/meLpMsGcvJsXUn3azA=; b=H7q6WLFIw2p9csmJh7DPZYXN1/ijQrp0QEkjDlKZVw/WKP2TOqap0SU58XP3FLqZ3O f0D7btn5gK79FK/dda1rcsSicyS7u9xjc+0XTOPBvwJVO/BsYCjY1vS+9ra4r8PV9mmH mLVGMAuwDpnkXl5vU12/zYEUy0fB92725OqldXNECMEiDDN+aXxMix7/JPZaRsKw56OT LWTQ/HFxGG+XvqQ3zgJaag59woteHglLI1cho+lHWzRHI4lloG6mqt1BGGhmT2Wp8Kra CmwF827XL6YAJj8Lx44Dr7UxGqOHnR0BhfxyUAc4BxxG/JVoIwuR0ckpLdKy/ge6AkLY Jjsw== X-Gm-Message-State: AA6/9Rkel3mnwLNVbNxNHsLNB0XvfvYhDNXEJ+nDaOLPQUlu0gsEZ0ZXtKGy+iBsHj7M0w== X-Received: by 10.31.10.137 with SMTP id 131mr6226365vkk.5.1476899318974; Wed, 19 Oct 2016 10:48:38 -0700 (PDT) Received: from jade.localdomain ([187.64.228.41]) by smtp.gmail.com with ESMTPSA id y72sm15917302vky.9.2016.10.19.10.48.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 10:48:38 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] dma-buf/sync_file: hold reference to fence when creating sync_file Date: Wed, 19 Oct 2016 15:48:32 -0200 Message-Id: <1476899313-22241-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 Cc: Gustavo Padovan 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 From: Gustavo Padovan fence referencing was out of balance. It was not taking any ref to the fence at creating time, but it was putting a reference when freeing the sync file. This patch fixes the balancing issue by getting a reference for the fence when creating the sync_file. Signed-off-by: Gustavo Padovan --- drivers/dma-buf/sync_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index b29a9e8..235f8ac 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -79,7 +79,7 @@ struct sync_file *sync_file_create(struct fence *fence) if (!sync_file) return NULL; - sync_file->fence = fence; + sync_file->fence = fence_get(fence); snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d", fence->ops->get_driver_name(fence),