if (vb->planes[plane].mem_priv) {
                        if (!reacquired) {
                                reacquired = true;
+                               vb->copied_timestamp = 0;
                                call_void_vb_qop(vb, buf_cleanup, vb);
                        }
                        call_void_memop(vb, put_userptr, vb->planes[plane].mem_priv);
 
                if (!reacquired) {
                        reacquired = true;
+                       vb->copied_timestamp = 0;
                        call_void_vb_qop(vb, buf_cleanup, vb);
                }
 
                if (vb->request)
                        media_request_put(vb->request);
                vb->request = NULL;
+               vb->copied_timestamp = 0;
        }
 }
 
 
        unsigned int i;
 
        for (i = start_idx; i < q->num_buffers; i++)
-               if (q->bufs[i]->timestamp == timestamp)
+               if (q->bufs[i]->copied_timestamp &&
+                   q->bufs[i]->timestamp == timestamp)
                        return i;
        return -1;
 }
 
        cap_vb->field = out_vb->field;
        cap_vb->flags &= ~mask;
        cap_vb->flags |= out_vb->flags & mask;
+       cap_vb->vb2_buf.copied_timestamp = 1;
 }
 EXPORT_SYMBOL_GPL(v4l2_m2m_buf_copy_metadata);
 
 
         * prepared:            this buffer has been prepared, i.e. the
         *                      buf_prepare op was called. It is cleared again
         *                      after the 'buf_finish' op is called.
+        * copied_timestamp:    the timestamp of this capture buffer was copied
+        *                      from an output buffer.
         * queued_entry:        entry on the queued buffers list, which holds
         *                      all buffers queued from userspace
         * done_entry:          entry on the list that stores all buffers ready
        enum vb2_buffer_state   state;
        unsigned int            synced:1;
        unsigned int            prepared:1;
+       unsigned int            copied_timestamp:1;
 
        struct vb2_plane        planes[VB2_MAX_PLANES];
        struct list_head        queued_entry;