From patchwork Sun May 19 06:03:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 17041 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-fa0-f72.google.com (mail-fa0-f72.google.com [209.85.161.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2FA2924AAB for ; Sun, 19 May 2013 06:04:35 +0000 (UTC) Received: by mail-fa0-f72.google.com with SMTP id v1sf3156319fav.7 for ; Sat, 18 May 2013 23:03:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to :mime-version:date:message-id:subject:from:to:cc:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=s0eJg+M6aML/Yz3uGX3O6DX0CUub6g4urlhhPRXPdqA=; b=YTQjkWfjGdPrsEGosXUYYsAnP6WeBezpP19khdQFQI0HO6wU6VWMHSRQqp1iLWYcHc cuxzBuLLQ8vdXAmIPtR/wlBNalEpYXiehPx31JWCI4VYL9uDNheeTcG2eDz0siuqvxfN J6JxaWAxT6+lmvJ68Ga0KXmob7eIYvo/RSk5xz9aokJAdTM4IAQwSbEEiktVZSV3FwEF Zq1hmwMbbz4QcOTBJuzVR++g9x/f0tm2MgUP5W6wXU8TjmzRwkyoRhZlReZzCXQ5keyB Kzy6FQMMD+paGeWuVU4jGWxe41GZI+xvAI1anNnxYP7Bb9YRxHdlbj6GoJwlfuwOYcNe zvBA== X-Received: by 10.180.185.115 with SMTP id fb19mr588650wic.0.1368943428379; Sat, 18 May 2013 23:03:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.88.35 with SMTP id bd3ls429243wib.44.canary; Sat, 18 May 2013 23:03:48 -0700 (PDT) X-Received: by 10.180.105.161 with SMTP id gn1mr4729690wib.5.1368943428180; Sat, 18 May 2013 23:03:48 -0700 (PDT) Received: from mail-ve0-x22d.google.com (mail-ve0-x22d.google.com [2607:f8b0:400c:c01::22d]) by mx.google.com with ESMTPS id nb6si1343341wic.97.2013.05.18.23.03.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 23:03:48 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22d; Received: by mail-ve0-f173.google.com with SMTP id cy12so4940485veb.4 for ; Sat, 18 May 2013 23:03:47 -0700 (PDT) X-Received: by 10.220.92.195 with SMTP id s3mr32714851vcm.9.1368943426993; Sat, 18 May 2013 23:03:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp36660vcs; Sat, 18 May 2013 23:03:46 -0700 (PDT) X-Received: by 10.112.145.72 with SMTP id ss8mr25729687lbb.12.1368943425449; Sat, 18 May 2013 23:03:45 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id s4si5821948laa.194.2013.05.18.23.03.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 23:03:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.175 is neither permitted nor denied by best guess record for domain of benjamin.gaignard@linaro.org) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id v10so5552262lbd.20 for ; Sat, 18 May 2013 23:03:44 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.201.104 with SMTP id jz8mr19512847lbc.61.1368943424555; Sat, 18 May 2013 23:03:44 -0700 (PDT) Received: by 10.114.77.74 with HTTP; Sat, 18 May 2013 23:03:44 -0700 (PDT) Date: Sun, 19 May 2013 08:03:44 +0200 Message-ID: Subject: dmabuf: Make sure that memory is unmapped before releasing it From: Benjamin Gaignard To: Benjamin Gaignard Cc: Patch Tracking X-Gm-Message-State: ALoCoQmNjK1T5uCpP6KpbAafkEgKk5qNE5M0mWa2sTC+EnY+pXO3riEiHtfkFg0KXPSz5ivxvot+ X-Original-Sender: benjamin.gaignard@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , >From e90e2bb8221b2671ecd2e19f48201b5871f3c6a5 Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Fri, 17 May 2013 07:16:08 +0000 Subject: dmabuf: Make sure that memory is unmapped before releasing it Be sure that memory is unmapped before releasing it. https://bugzilla.gnome.org/show_bug.cgi?id=700411 --- -- cgit v0.9.0.2-2-gbebe diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c index 95d26bb..4a95f47 100644 --- a/gst-libs/gst/allocators/gstdmabuf.c +++ b/gst-libs/gst/allocators/gstdmabuf.c @@ -62,17 +62,18 @@ GST_DEBUG_CATEGORY_STATIC (dmabuf_debug); #define GST_CAT_DEFAULT dmabuf_debug static void -gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * mem) +gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * gmem) { - GstDmaBufMemory *dbmem = (GstDmaBufMemory *) mem; - - if (dbmem->data) - g_warning ("Freeing memory still mapped"); + GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem; - close (dbmem->fd); - g_mutex_clear (&dbmem->lock); - g_slice_free (GstDmaBufMemory, dbmem); - GST_DEBUG ("%p: freed", dbmem); + if (mem->data) { + g_warning (G_STRLOC ":%s: Freeing memory %p still mapped", G_STRFUNC, mem); + munmap ((void *) mem->data, mem->mmap_size); + } + close (mem->fd); + g_mutex_clear (&mem->lock); + g_slice_free (GstDmaBufMemory, mem); + GST_DEBUG ("%p: freed", mem); } static gpointer