Linux Media Controller development
 help / color / mirror / Atom feed
* videobuf2-vmalloc suspect for corrupted data
@ 2014-04-07  9:56 Divneil Wadhawan
  2014-04-07 10:27 ` Pawel Osciak
  0 siblings, 1 reply; 8+ messages in thread
From: Divneil Wadhawan @ 2014-04-07  9:56 UTC (permalink / raw)
  To: linux-media@vger.kernel.org

Hi,

I have a V4L2 capture driver accepting a malloc'ed buffer. 
The driver is using vb2_vmalloc_memops (../drivers/media/v4l2-core/videobuf2-vmalloc.c) for user-space to kvaddr translation.
Randomly, corrupted data is received by user-app.

So, the question is regarding the handling of get_userptr, put_userptr by v4l2-core:

const struct vb2_mem_ops vb2_vmalloc_memops = {
         ........
         .get_userptr    = vb2_vmalloc_get_userptr, (get_user_pages() and vm_map_ram())
         .put_userptr    = vb2_vmalloc_put_userptr, (set_page_dirty_lock() and put_page())
          .....
};

The driver prepares for the transaction by virtue of v4l2-core calling get_userptr (QBUF) 
After data is filled, driver puts on a done list (DQBUF)

We never mark the pages as dirty (or put_userptr) after a transaction is complete.
Here, in v4l2 core (videobuf2-core.c) , we conditionally put_userptr - when a QBUF with a different userptr on same index, or releasing buffers.

Is it correct? Probably seems to be the reason for corrupted data.

Regards,
Divneil 		 	   		  

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-08  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07  9:56 videobuf2-vmalloc suspect for corrupted data Divneil Wadhawan
2014-04-07 10:27 ` Pawel Osciak
2014-04-07 10:49   ` Divneil Wadhawan
2014-04-07 10:57     ` Hans Verkuil
2014-04-07 11:20       ` Divneil Wadhawan
2014-04-07 11:46         ` Divneil Wadhawan
2014-04-07 12:51         ` Hans Verkuil
2014-04-08  9:55           ` Divneil Wadhawan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox