<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/media, branch v3.18.131</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.131</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.131'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2018-10-13T07:09:28Z</updated>
<entry>
<title>media: v4l: event: Prevent freeing event subscriptions while accessed</title>
<updated>2018-10-13T07:09:28Z</updated>
<author>
<name>Sakari Ailus</name>
<email>sakari.ailus@linux.intel.com</email>
</author>
<published>2018-09-11T09:32:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=10c134df948c2d581f5b89a44072a07ba8cf4069'/>
<id>urn:sha1:10c134df948c2d581f5b89a44072a07ba8cf4069</id>
<content type='text'>
commit ad608fbcf166fec809e402d548761768f602702c upstream.

The event subscriptions are added to the subscribed event list while
holding a spinlock, but that lock is subsequently released while still
accessing the subscription object. This makes it possible to unsubscribe
the event --- and freeing the subscription object's memory --- while
the subscription object is simultaneously accessed.

Prevent this by adding a mutex to serialise the event subscription and
unsubscription. This also gives a guarantee to the callback ops that the
add op has returned before the del op is called.

This change also results in making the elems field less special:
subscriptions are only added to the event list once they are fully
initialised.

Signed-off-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Reviewed-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Cc: stable@vger.kernel.org # for 4.14 and up
Fixes: c3b5b0241f62 ("V4L/DVB: V4L: Events: Add backend")
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Merge branch 'patchwork' into v4l_for_linus</title>
<updated>2014-10-09T17:00:54Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2014-10-09T17:00:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a66d05d504a24894a8fdf11e4569752f313e5764'/>
<id>urn:sha1:a66d05d504a24894a8fdf11e4569752f313e5764</id>
<content type='text'>
* patchwork: (544 commits)
  [media] ir-hix5hd2: fix build on c6x arch
  [media] pt3: fix DTV FE I2C driver load error paths
  Revert "[media] media: em28xx - remove reset_resume interface"
  [media] exynos4-is: fix some warnings when compiling on arm64
  [media] usb drivers: use %zu instead of %zd
  [media] pci drivers: use %zu instead of %zd
  [media] dvb-frontends: use %zu instead of %zd
  [media] s5p-mfc: Fix several printk warnings
  [media] s5p_mfc_opr: Fix warnings
  [media] ti-vpe: Fix typecast
  [media] s3c-camif: fix dma_addr_t printks
  [media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits
  [media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64
  [media] em28xx: Fix identation
  [media] drxd: remove a dead code
  [media] saa7146: remove return after BUG()
  [media] cx88: remove return after BUG()
  [media] cx88: fix cards table CodingStyle
  [media] radio-sf16fmr2: declare some structs as static
  [media] radio-sf16fmi: declare pnp_attached as static
  ...

Conflicts:
	Documentation/DocBook/media/v4l/compat.xml
</content>
</entry>
<entry>
<title>[media] rc: add dvbsky rc keymap macro</title>
<updated>2014-09-23T19:13:49Z</updated>
<author>
<name>nibble.max</name>
<email>nibble.max@gmail.com</email>
</author>
<published>2014-08-06T04:40:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8db3e5df4b5aa5ab8ce1edb8ee59ca9f2c2e7cd9'/>
<id>urn:sha1:8db3e5df4b5aa5ab8ce1edb8ee59ca9f2c2e7cd9</id>
<content type='text'>
This RC will be used by DVBSky driver, added on the next patch.

Signed-off-by: Nibble Max &lt;nibble.max@gmail.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] v4l: videobuf2: Fix typos in comments</title>
<updated>2014-09-23T19:13:40Z</updated>
<author>
<name>Laurent Pinchart</name>
<email>laurent.pinchart@ideasonboard.com</email>
</author>
<published>2014-09-11T22:43:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=072f1a489efa348223db07730c4b946a4b1ca0cc'/>
<id>urn:sha1:072f1a489efa348223db07730c4b946a4b1ca0cc</id>
<content type='text'>
The buffer flags are incorrectly referred to as V4L2_BUF_FLAGS_* instead
of V4L2_BUF_FLAG_* in comments. Fix it.

Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Acked-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Acked-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] vb2: fix VBI/poll regression</title>
<updated>2014-09-21T23:57:30Z</updated>
<author>
<name>Hans Verkuil</name>
<email>hans.verkuil@cisco.com</email>
</author>
<published>2014-09-20T19:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=58d75f4b1ce26324b4d809b18f94819843a98731'/>
<id>urn:sha1:58d75f4b1ce26324b4d809b18f94819843a98731</id>
<content type='text'>
The recent conversion of saa7134 to vb2 unconvered a poll() bug that
broke the teletext applications alevt and mtt. These applications
expect that calling poll() without having called VIDIOC_STREAMON will
cause poll() to return POLLERR. That did not happen in vb2.

This patch fixes that behavior. It also fixes what should happen when
poll() is called when STREAMON is called but no buffers have been
queued. In that case poll() will also return POLLERR, but only for
capture queues since output queues will always return POLLOUT
anyway in that situation.

This brings the vb2 behavior in line with the old videobuf behavior.

Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Acked-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] videobuf2-core.h: fix comment</title>
<updated>2014-09-21T23:45:23Z</updated>
<author>
<name>Hans Verkuil</name>
<email>hans.verkuil@cisco.com</email>
</author>
<published>2014-08-04T10:12:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=44e8e69d46db9928cd3b81cbea4ca24257412286'/>
<id>urn:sha1:44e8e69d46db9928cd3b81cbea4ca24257412286</id>
<content type='text'>
The comment for start_streaming that tells the developer with which vb2 state
buffers should be returned to vb2 gave the wrong state. Very confusing.

Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Acked-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] media: videobuf2-core.h: add a helper to get status of start_streaming()</title>
<updated>2014-09-21T23:15:39Z</updated>
<author>
<name>Prabhakar Lad</name>
<email>prabhakar.csengg@gmail.com</email>
</author>
<published>2014-09-06T15:26:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ead130335f35fb732921ee0ffde6639be35aa108'/>
<id>urn:sha1:ead130335f35fb732921ee0ffde6639be35aa108</id>
<content type='text'>
this patch adds a helper to get the status if start_streaming()
was called successfully.

Signed-off-by: Lad, Prabhakar &lt;prabhakar.csengg@gmail.com&gt;
Cc: Pawel Osciak &lt;pawel@osciak.com&gt;
Cc: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Cc: Kyungmin Park &lt;kyungmin.park@samsung.com&gt;
Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] dm644x_ccdc: use unsigned long for fpc_table_addr</title>
<updated>2014-08-26T21:52:03Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>m.chehab@samsung.com</email>
</author>
<published>2014-08-22T12:00:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8dece35daf098e5d086b50724119ffbb24ceca7f'/>
<id>urn:sha1:8dece35daf098e5d086b50724119ffbb24ceca7f</id>
<content type='text'>
The fpc_table_addr is used as an unsigned integer that stores
an address. At the Kernel, the proper type for such integers
is unsigned long.

This generates lots of warnings when compiling on 64 bits.

Signed-off-by: Mauro Carvalho Chehab &lt;m.chehab@samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] videobuf2: fix lockdep warning</title>
<updated>2014-08-21T20:25:31Z</updated>
<author>
<name>Hans Verkuil</name>
<email>hverkuil@xs4all.nl</email>
</author>
<published>2014-08-07T06:47:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f035eb4e976ef5a059e30bc91cfd310ff030a7d3'/>
<id>urn:sha1:f035eb4e976ef5a059e30bc91cfd310ff030a7d3</id>
<content type='text'>
The following lockdep warning has been there ever since commit a517cca6b24fc54ac209e44118ec8962051662e3
one year ago:

[  403.117947] ======================================================
[  403.117949] [ INFO: possible circular locking dependency detected ]
[  403.117953] 3.16.0-rc6-test-media #961 Not tainted
[  403.117954] -------------------------------------------------------
[  403.117956] v4l2-ctl/15377 is trying to acquire lock:
[  403.117959]  (&amp;dev-&gt;mutex#3){+.+.+.}, at: [&lt;ffffffffa005a6c3&gt;] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.117974]
[  403.117974] but task is already holding lock:
[  403.117976]  (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;ffffffff8118291f&gt;] vm_mmap_pgoff+0x6f/0xc0
[  403.117987]
[  403.117987] which lock already depends on the new lock.
[  403.117987]
[  403.117990]
[  403.117990] the existing dependency chain (in reverse order) is:
[  403.117992]
[  403.117992] -&gt; #1 (&amp;mm-&gt;mmap_sem){++++++}:
[  403.117997]        [&lt;ffffffff810d733c&gt;] validate_chain.isra.39+0x5fc/0x9a0
[  403.118006]        [&lt;ffffffff810d8bc3&gt;] __lock_acquire+0x4d3/0xd30
[  403.118010]        [&lt;ffffffff810d9da7&gt;] lock_acquire+0xa7/0x160
[  403.118014]        [&lt;ffffffff8118c9ec&gt;] might_fault+0x7c/0xb0
[  403.118018]        [&lt;ffffffffa0028a25&gt;] video_usercopy+0x425/0x610 [videodev]
[  403.118028]        [&lt;ffffffffa0028c25&gt;] video_ioctl2+0x15/0x20 [videodev]
[  403.118034]        [&lt;ffffffffa0022764&gt;] v4l2_ioctl+0x184/0x1a0 [videodev]
[  403.118040]        [&lt;ffffffff811d77d0&gt;] do_vfs_ioctl+0x2f0/0x4f0
[  403.118307]        [&lt;ffffffff811d7a51&gt;] SyS_ioctl+0x81/0xa0
[  403.118311]        [&lt;ffffffff8199dc69&gt;] system_call_fastpath+0x16/0x1b
[  403.118319]
[  403.118319] -&gt; #0 (&amp;dev-&gt;mutex#3){+.+.+.}:
[  403.118324]        [&lt;ffffffff810d6a96&gt;] check_prevs_add+0x746/0x9f0
[  403.118329]        [&lt;ffffffff810d733c&gt;] validate_chain.isra.39+0x5fc/0x9a0
[  403.118333]        [&lt;ffffffff810d8bc3&gt;] __lock_acquire+0x4d3/0xd30
[  403.118336]        [&lt;ffffffff810d9da7&gt;] lock_acquire+0xa7/0x160
[  403.118340]        [&lt;ffffffff81999664&gt;] mutex_lock_interruptible_nested+0x64/0x640
[  403.118344]        [&lt;ffffffffa005a6c3&gt;] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118349]        [&lt;ffffffffa0022122&gt;] v4l2_mmap+0x62/0xa0 [videodev]
[  403.118354]        [&lt;ffffffff81197270&gt;] mmap_region+0x3d0/0x5d0
[  403.118359]        [&lt;ffffffff8119778d&gt;] do_mmap_pgoff+0x31d/0x400
[  403.118363]        [&lt;ffffffff81182940&gt;] vm_mmap_pgoff+0x90/0xc0
[  403.118366]        [&lt;ffffffff81195cef&gt;] SyS_mmap_pgoff+0x1df/0x2a0
[  403.118369]        [&lt;ffffffff810085c2&gt;] SyS_mmap+0x22/0x30
[  403.118376]        [&lt;ffffffff8199dc69&gt;] system_call_fastpath+0x16/0x1b
[  403.118381]
[  403.118381] other info that might help us debug this:
[  403.118381]
[  403.118383]  Possible unsafe locking scenario:
[  403.118383]
[  403.118385]        CPU0                    CPU1
[  403.118387]        ----                    ----
[  403.118388]   lock(&amp;mm-&gt;mmap_sem);
[  403.118391]                                lock(&amp;dev-&gt;mutex#3);
[  403.118394]                                lock(&amp;mm-&gt;mmap_sem);
[  403.118397]   lock(&amp;dev-&gt;mutex#3);
[  403.118400]
[  403.118400]  *** DEADLOCK ***
[  403.118400]
[  403.118403] 1 lock held by v4l2-ctl/15377:
[  403.118405]  #0:  (&amp;mm-&gt;mmap_sem){++++++}, at: [&lt;ffffffff8118291f&gt;] vm_mmap_pgoff+0x6f/0xc0
[  403.118411]
[  403.118411] stack backtrace:
[  403.118415] CPU: 0 PID: 15377 Comm: v4l2-ctl Not tainted 3.16.0-rc6-test-media #961
[  403.118418] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
[  403.118420]  ffffffff82a6c9d0 ffff8800af37fb00 ffffffff819916a2 ffffffff82a6c9d0
[  403.118425]  ffff8800af37fb40 ffffffff810d5715 ffff8802308e4200 0000000000000000
[  403.118429]  ffff8802308e4a48 ffff8802308e4a48 ffff8802308e4200 0000000000000001
[  403.118433] Call Trace:
[  403.118441]  [&lt;ffffffff819916a2&gt;] dump_stack+0x4e/0x7a
[  403.118445]  [&lt;ffffffff810d5715&gt;] print_circular_bug+0x1d5/0x2a0
[  403.118449]  [&lt;ffffffff810d6a96&gt;] check_prevs_add+0x746/0x9f0
[  403.118455]  [&lt;ffffffff8119c172&gt;] ? find_vmap_area+0x42/0x70
[  403.118459]  [&lt;ffffffff810d733c&gt;] validate_chain.isra.39+0x5fc/0x9a0
[  403.118463]  [&lt;ffffffff810d8bc3&gt;] __lock_acquire+0x4d3/0xd30
[  403.118468]  [&lt;ffffffff810d9da7&gt;] lock_acquire+0xa7/0x160
[  403.118472]  [&lt;ffffffffa005a6c3&gt;] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118476]  [&lt;ffffffffa005a6c3&gt;] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118480]  [&lt;ffffffff81999664&gt;] mutex_lock_interruptible_nested+0x64/0x640
[  403.118484]  [&lt;ffffffffa005a6c3&gt;] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118488]  [&lt;ffffffffa005a6c3&gt;] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118493]  [&lt;ffffffff810d8055&gt;] ? mark_held_locks+0x75/0xa0
[  403.118497]  [&lt;ffffffffa005a6c3&gt;] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118502]  [&lt;ffffffffa0022122&gt;] v4l2_mmap+0x62/0xa0 [videodev]
[  403.118506]  [&lt;ffffffff81197270&gt;] mmap_region+0x3d0/0x5d0
[  403.118510]  [&lt;ffffffff8119778d&gt;] do_mmap_pgoff+0x31d/0x400
[  403.118513]  [&lt;ffffffff81182940&gt;] vm_mmap_pgoff+0x90/0xc0
[  403.118517]  [&lt;ffffffff81195cef&gt;] SyS_mmap_pgoff+0x1df/0x2a0
[  403.118521]  [&lt;ffffffff810085c2&gt;] SyS_mmap+0x22/0x30
[  403.118525]  [&lt;ffffffff8199dc69&gt;] system_call_fastpath+0x16/0x1b

The reason is that vb2_fop_mmap and vb2_fop_get_unmapped_area take the core lock
while they are called with the mmap_sem semaphore held. But elsewhere in the code
the core lock is taken first but calls to copy_to/from_user() can take the mmap_sem
semaphore as well, potentially causing a classical A-B/B-A deadlock.

However, the mmap/get_unmapped_area calls really shouldn't take the core lock
at all. So what would happen if they don't take the core lock anymore?

There are two situations that need to be taken into account: calling mmap while
new buffers are being added and calling mmap while buffers are being deleted.

The first case works almost fine without a lock: in all cases mmap relies on
correctly filled-in q-&gt;num_buffers/q-&gt;num_planes values and those are only
updated by reqbufs and create_buffers *after* any new buffers have been
initialized completely. Except in one case: if an error occurred while allocating
the buffers it will increase num_buffers and rely on __vb2_queue_free to
decrease it again. So there is a short period where the buffer information
may be wrong.

The second case definitely does pose a problem: buffers may be in the process
of being deleted, without the internal structure being updated.

In order to fix this a new mutex is added to vb2_queue that is taken when
buffers are allocated or deleted, and in vb2_mmap. That way vb2_mmap won't
get stale buffer data. Note that this is a problem only for MEMORY_MMAP, so
even though __qbuf_userptr and __qbuf_dmabuf also mess around with buffers
(mem_priv in particular), this doesn't clash with vb2_mmap or
vb2_get_unmapped_area since those are MMAP specific.

As an additional bonus the hack in __buf_prepare, the USERPTR case, can be
removed as well since mmap() no longer takes the core lock.

All in all a much cleaner solution.

Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Acked-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Acked-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;m.chehab@samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] omap3isp: ccdc: Add basic support for interlaced video</title>
<updated>2014-08-21T20:25:14Z</updated>
<author>
<name>Laurent Pinchart</name>
<email>laurent.pinchart@ideasonboard.com</email>
</author>
<published>2014-05-19T19:37:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9a36d8ed33c481a99f69f8a2eeb22e3c7750e522'/>
<id>urn:sha1:9a36d8ed33c481a99f69f8a2eeb22e3c7750e522</id>
<content type='text'>
When the CCDC input is interlaced enable the alternate field order on
the CCDC output video node. The field signal polarity is specified
through platform data.

Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Tested-by: Enrico Butera &lt;ebutera@users.sourceforge.net&gt;
Acked-by: Sakari Ailus &lt;sakari.ailus@iki.fi&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;m.chehab@samsung.com&gt;
</content>
</entry>
</feed>
