From patchwork Wed Sep 21 07:20:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9342935 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 119A5607D0 for ; Wed, 21 Sep 2016 07:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E025E2A14C for ; Wed, 21 Sep 2016 07:20:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4DEB2A172; Wed, 21 Sep 2016 07:20:34 +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 5BBDF2A14C for ; Wed, 21 Sep 2016 07:20:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19FFA6E1B1; Wed, 21 Sep 2016 07:20:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36E0A6E1B1 for ; Wed, 21 Sep 2016 07:20:25 +0000 (UTC) Received: by mail-lf0-f65.google.com with SMTP id l131so1958127lfl.0 for ; Wed, 21 Sep 2016 00:20:25 -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=WlQ1TR4AHoIXnUgTa01f/1//CgMbZde3PWg9w9eEq28=; b=b6L668GLp8pIgu/SH8/Qug59nKW3tHTd4+wOuItdrz773CdMmJmaCF6K20nI+AA17x XUcLUqJbLK6yB2bqK09m7PZiY5rDO3BfWwnMSGfjGsAKUZMcoKXX0AwQgOgJOW9v/Hwe yNvs68WEW6H8YfJjirN+M42Hwq4b6toj0i5xZgmdb1dJxPZ5jWwis0TbrDEjP3SDqhwv ts8xGfXxYedvzH0pq6S1WV5XYLVF8rAzdTrRWbjQ5oBTibPB9TAjxtGdU19vht1ivhgG 3AiaoOXYR8XGlmbSNYXW1nHOkdECpqKo3BeH35LQ8UeAPi67p3QAPST6fUFa7WIigWdz ecdg== X-Gm-Message-State: AE9vXwOR5Cj6YjwO/ARGSEk/u4+zjTjkNCVwdEvS7hELYt5ALlGTnnl68hcQSyFeaONLqg== X-Received: by 10.25.212.5 with SMTP id l5mr14670075lfg.73.1474442422371; Wed, 21 Sep 2016 00:20:22 -0700 (PDT) Received: from jade.haaga-helia.fi (pub-nat.haaga-helia.fi. [193.166.13.253]) by smtp.gmail.com with ESMTPSA id j196sm6462906lfg.9.2016.09.21.00.20.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 00:20:21 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH] dma-buf/sync_file: free fences array in num_fences is 1 Date: Wed, 21 Sep 2016 10:20:19 +0300 Message-Id: <1474442419-6040-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 When merging sync_files there is a case when we can end up with only one fence in the merged sync_file: when all fences belong to the same timeline. So for this case a fence_array is not created instead we just assigned the fence to sync_file->fence. Then we do not use the fences array anymore nor does free it. This patch frees the array. Signed-off-by: Gustavo Padovan Reported-by: Chris Wilson Reviewed-by: Chris Wilson --- drivers/dma-buf/sync_file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index 706eea9..9ed4f9f 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -150,6 +150,7 @@ static int sync_file_set_fence(struct sync_file *sync_file, */ if (num_fences == 1) { sync_file->fence = fences[0]; + kfree(fences); } else { array = fence_array_create(num_fences, fences, fence_context_alloc(1), 1, false);