From: Michael Olbrich Date: Fri, 23 Aug 2013 16:06:36 +0000 (+0200) Subject: dmabuf: fix mmap counting X-Git-Tag: 1.19.3~511^2~5065 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c66c2a43d6f189b07ab682b4d23db04ade9acbc;p=platform%2Fupstream%2Fgstreamer.git dmabuf: fix mmap counting A successful gst_dmabuf_mem_map must always increment the mmap count. Otherwise the first gst_dmabuf_mem_unmap will unmap the memory and all other user will access unmapped memory. https://bugzilla.gnome.org/show_bug.cgi?id=706680 --- diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c index 1c8abc4..87d0c75 100644 --- a/gst-libs/gst/allocators/gstdmabuf.c +++ b/gst-libs/gst/allocators/gstdmabuf.c @@ -90,8 +90,10 @@ gst_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags) if (mem->data) { /* only return address if mapping flags are a subset * of the previous flags */ - if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize)) + if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize)) { ret = mem->data; + mem->mmap_count++; + } goto out; }