From: Michael Olbrich Date: Tue, 20 May 2014 10:28:15 +0000 (+0200) Subject: dmabuf: fix checking mmap flags X-Git-Tag: 1.19.3~511^2~4493 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42623c995e97a4eda3ca641b37584a4f66f9e095;p=platform%2Fupstream%2Fgstreamer.git dmabuf: fix checking mmap flags A simple '&' is not sufficiant. With mmapping_flags == PROT_READ and prot == PROT_READ|PROT_WRITE the check produces the wrong result. Change the check to make sure that prot is a subset of mmapping_flags. https://bugzilla.gnome.org/show_bug.cgi?id=730559 --- diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c index 046b38b..9cf05cb 100644 --- a/gst-libs/gst/allocators/gstdmabuf.c +++ b/gst-libs/gst/allocators/gstdmabuf.c @@ -97,7 +97,7 @@ 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) { + if ((mem->mmapping_flags & prot) == prot) { ret = mem->data; mem->mmap_count++; }