1. 08 11月, 2019 1 次提交
    • H
      media: vivid: add vivid_create_queue() helper · 0c90f649
      Hans Verkuil 提交于
      Refactor some of the vivid_create_instance code by using a
      new vivid_create_queue() helper function.
      
      Also add some sanity checks for the node_types vs input/output_types
      module options.
      
      This patch resolves these two smatch parse errors:
      
      drivers/media/platform/vivid/vivid-core.c:1679 vivid_create_instance() parse error: OOM: 3002600Kb sm_state_count = 6160113
      drivers/media/platform/vivid/vivid-core.c: drivers/media/platform/vivid/vivid-core.c:1679
      vivid_create_instance() parse error: __split_smt: function too hairy.  Giving up after 33 seconds
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@kernel.org>
      0c90f649
  2. 05 11月, 2019 1 次提交
    • H
      media: vivid: media_device_cleanup was called too early · 8ffd573c
      Hans Verkuil 提交于
      Running the contrib/test/test-media script in v4l-utils with the vivid argument
      will cause this kernel warning:
      
      [  104.748720] videodev: v4l2_release
      [  104.748731] ------------[ cut here ]------------
      [  104.748750] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
      [  104.748790] WARNING: CPU: 6 PID: 1823 at kernel/locking/mutex.c:938 __mutex_lock+0x919/0xc10
      [  104.748800] Modules linked in: rc_cec vivid v4l2_tpg videobuf2_dma_contig cec rc_core v4l2_dv_timings videobuf2_vmalloc videobuf2_memops
      videobuf2_v4l2 videobuf2_common videodev mc vmw_balloon vmw_vmci button vmwgfx
      [  104.748845] CPU: 6 PID: 1823 Comm: sleep Not tainted 5.4.0-rc1-test-no #150
      [  104.748853] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/29/2019
      [  104.748867] RIP: 0010:__mutex_lock+0x919/0xc10
      [  104.748878] Code: 59 83 e8 9a fc 16 ff 44 8b 05 23 61 38 01 45 85 c0 0f 85 ef f7 ff ff 48 c7 c6 a0 1f 87 82 48 c7 c7 a0 1e 87 82 e8 cd bb
      f7 fe <0f> 0b e9 d5 f7 ff ff f6 c3 04 0f 84 3b fd ff ff 49 89 df 41 83 e7
      [  104.748886] RSP: 0018:ffff88811a357b80 EFLAGS: 00010286
      [  104.748895] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      [  104.748902] RDX: 0000000000000003 RSI: 0000000000000004 RDI: ffffed102346af62
      [  104.748910] RBP: ffff88811a357cf0 R08: ffffffff81217c91 R09: fffffbfff061c271
      [  104.748917] R10: fffffbfff061c270 R11: ffffffff830e1383 R12: ffff8881a46103c0
      [  104.748924] R13: 0000000000000000 R14: ffff8881a4614f90 R15: ffff8881a46153d0
      [  104.748933] FS:  0000000000000000(0000) GS:ffff8881b6780000(0000) knlGS:0000000000000000
      [  104.748940] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  104.748949] CR2: 00007f163fc9ca20 CR3: 0000000003013004 CR4: 00000000001606e0
      [  104.749036] Call Trace:
      [  104.749051]  ? _raw_spin_unlock+0x1f/0x30
      [  104.749067]  ? llist_add_batch+0x33/0x50
      [  104.749081]  ? tick_nohz_tick_stopped+0x19/0x30
      [  104.749130]  ? v4l2_release.cold+0x6c/0xd6 [videodev]
      [  104.749143]  ? mutex_lock_io_nested+0xb80/0xb80
      [  104.749153]  ? vprintk_emit+0xf2/0x220
      [  104.749191]  ? vivid_req_validate+0x40/0x40 [vivid]
      [  104.749201]  ? printk+0xad/0xde
      [  104.749211]  ? kmsg_dump_rewind_nolock+0x54/0x54
      [  104.749226]  ? locks_remove_file+0x78/0x2b0
      [  104.749248]  ? __fsnotify_update_child_dentry_flags.part.0+0x170/0x170
      [  104.749281]  ? vivid_req_validate+0x40/0x40 [vivid]
      [  104.749321]  ? v4l2_release.cold+0x6c/0xd6 [videodev]
      [  104.749361]  v4l2_release.cold+0x6c/0xd6 [videodev]
      [  104.749378]  __fput+0x15a/0x390
      [  104.749393]  task_work_run+0xb2/0xe0
      [  104.749407]  do_exit+0x4d0/0x1200
      [  104.749422]  ? do_user_addr_fault+0x367/0x610
      [  104.749431]  ? release_task+0x990/0x990
      [  104.749449]  ? rwsem_spin_on_owner+0x170/0x170
      [  104.749463]  ? vmacache_find+0xb2/0x100
      [  104.749476]  do_group_exit+0x85/0x130
      [  104.749487]  __x64_sys_exit_group+0x23/0x30
      [  104.749500]  do_syscall_64+0x5e/0x1c0
      [  104.749511]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  104.749520] RIP: 0033:0x7f163fc5c9d6
      [  104.749536] Code: Bad RIP value.
      [  104.749543] RSP: 002b:00007ffe6f3bec58 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      [  104.749553] RAX: ffffffffffffffda RBX: 00007f163fd4d760 RCX: 00007f163fc5c9d6
      [  104.749560] RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
      [  104.749567] RBP: 0000000000000000 R08: 00000000000000e7 R09: ffffffffffffff80
      [  104.749574] R10: 00007ffe6f3beb24 R11: 0000000000000246 R12: 00007f163fd4d760
      [  104.749581] R13: 0000000000000002 R14: 00007f163fd56428 R15: 0000000000000000
      [  104.749597] ---[ end trace 66f20f73fc0daf79 ]---
      
      This is caused by media_device_cleanup() which destroys
      v4l2_dev->mdev->req_queue_mutex. But v4l2_release() tries to lock
      that mutex after media_device_cleanup() is called.
      
      By moving media_device_cleanup() to the v4l2_device's release function it is
      guaranteed that the mutex is valid whenever v4l2_release is called.
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@kernel.org>
      8ffd573c
  3. 24 10月, 2019 2 次提交
  4. 02 10月, 2019 1 次提交
  5. 31 7月, 2019 1 次提交
  6. 30 7月, 2019 1 次提交
  7. 25 7月, 2019 2 次提交
  8. 23 7月, 2019 3 次提交
    • A
      media: vivid: work around high stack usage with clang · 1a03f91c
      Arnd Bergmann 提交于
      Building a KASAN-enabled kernel with clang ends up in a case where too
      much is inlined into vivid_thread_vid_cap() and the stack usage grows
      a lot, possibly when the register allocation fails to produce efficient
      code and spills a lot of temporaries to the stack. This uses more
      than twice the amount of stack than the sum of the individual functions
      when they are not inlined:
      
      drivers/media/platform/vivid/vivid-kthread-cap.c:766:12: error: stack frame size of 2208 bytes in function 'vivid_thread_vid_cap' [-Werror,-Wframe-larger-than=]
      
      Marking two of the key functions in here as 'noinline_for_stack' avoids
      the pathological case in clang without any apparent downside for gcc.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      1a03f91c
    • V
      media: vivid:add sanity check to avoid divide error and set value to 1 if 0. · aa9c2182
      Vandana BN 提交于
      Syzbot reported divide error in vivid_thread_vid_cap, which has been
      seen only once and does not have a reproducer.
      This patch adds sanity checks for the
      denominator value with WARN_ON if it is 0 and replaces it with 1.
      
      divide error: 0000 [#1] PREEMPT SMP KASAN
      kobject: 'tx-0' (0000000017161f7f): kobject_uevent_env
      CPU: 0 PID: 23689 Comm: vivid-003-vid-c Not tainted 5.0.0-rc4+ #58
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      RIP: 0010:vivid_cap_update_frame_period
      drivers/media/platform/vivid/vivid-kthread-cap.c:661 [inline]
      RIP: 0010:vivid_thread_vid_cap+0x221/0x284
      drivers/media/platform/vivid/vivid-kthread-cap.c:789
      Code: 48 c1 e9 03 0f b6 0c 11 48 89 f2 48 69 c0 00 ca 9a 3b 83 c2 03 38
      ca
      7c 08 84 c9 0f 85 f0 1e 00 00 41 8b 8f 24 64 00 00 31 d2 <48> f7 f1 49
      89
      c4 48 89 c3 49 8d 87 28 64 00 00 48 89 c2 48 89 45
      RSP: 0018:ffff88808b4afd68 EFLAGS: 00010246
      kobject: 'tx-0' (0000000017161f7f): fill_kobj_path: path
      = '/devices/virtual/net/gre0/queues/tx-0'
      RAX: 000000de5a6f8e00 RBX: 0000000100047b22 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000004
      RBP: ffff88808b4aff00 R08: ffff88804862e1c0 R09: ffffffff89997008
      R10: ffffffff89997010 R11: 0000000000000001 R12: 00000000fffffffc
      R13: ffff8880a17e0500 R14: ffff88803e40f760 R15: ffff8882182b0140
      FS:  0000000000000000(0000) GS:ffff8880ae800000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000004cdc90 CR3: 000000005d827000 CR4: 00000000001426f0
      Call Trace:
      kobject: 'gretap0' (00000000d7549098): kobject_add_internal: parent:
      'net',
      set: 'devices'
      kobject: 'loop2' (0000000094ed4ee4): kobject_uevent_env
      kobject: 'loop2' (0000000094ed4ee4): fill_kobj_path: path
      = '/devices/virtual/block/loop2'
        kthread+0x357/0x430 kernel/kthread.c:246
      kobject: 'gretap0' (00000000d7549098): kobject_uevent_env
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
      Modules linked in:
      kobject: 'gretap0' (00000000d7549098): fill_kobj_path: path
      = '/devices/virtual/net/gretap0'
      ---[ end trace bc5c8b25b64d768f ]---
      kobject: 'loop1' (0000000032036b86): kobject_uevent_env
      RIP: 0010:vivid_cap_update_frame_period
      drivers/media/platform/vivid/vivid-kthread-cap.c:661 [inline]
      RIP: 0010:vivid_thread_vid_cap+0x221/0x2840
      drivers/media/platform/vivid/vivid-kthread-cap.c:789
      kobject: 'loop1' (0000000032036b86): fill_kobj_path: path
      = '/devices/virtual/block/loop1'
      Code: 48 c1 e9 03 0f b6 0c 11 48 89 f2 48 69 c0 00 ca 9a 3b 83 c2 03 38
      ca
      7c 08 84 c9 0f 85 f0 1e 00 00 41 8b 8f 24 64 00 00 31 d2 <48> f7 f1 49
      89
      c4 48 89 c3 49 8d 87 28 64 00 00 48 89 c2 48 89 45
      kobject: 'loop0' (00000000dd9927c3): kobject_uevent_env
      RSP: 0018:ffff88808b4afd68 EFLAGS: 00010246
      RAX: 000000de5a6f8e00 RBX: 0000000100047b22 RCX: 0000000000000000
      kobject: 'queues' (000000007ed20666): kobject_add_internal:
      parent: 'gretap0', set: '<NULL>'
      RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000004
      RBP: ffff88808b4aff00 R08: ffff88804862e1c0 R09: ffffffff89997008
      kobject: 'loop0' (00000000dd9927c3): fill_kobj_path: path
      = '/devices/virtual/block/loop0'
      R10: ffffffff89997010 R11: 0000000000000001 R12: 00000000fffffffc
      kobject: 'queues' (000000007ed20666): kobject_uevent_env
      R13: ffff8880a17e0500 R14: ffff88803e40f760 R15: ffff8882182b0140
      FS:  0000000000000000(0000) GS:ffff8880ae800000(0000)
      knlGS:0000000000000000
      kobject: 'loop5' (00000000a41f9e79): kobject_uevent_env
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      kobject: 'queues' (000000007ed20666): kobject_uevent_env: filter
      function
      caused the event to drop!
      CR2: 00000000004cdc90 CR3: 000000005d827000 CR4: 00000000001426f0
      kobject: 'loop5' (00000000a41f9e79): fill_kobj_path: path
      = '/devices/virtual/block/loop5'
      
      Reported-by: syz...@syzkaller.appspotmail.com
      Signed-off-by: NVandana BN <bnvandana@gmail.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      aa9c2182
    • C
      media: vivid: fix potential integer overflow on left shift · b98fd3cb
      Colin Ian King 提交于
      There is a potential integer overflow when int 2 is left shifted
      as this is evaluated using 32 bit arithmetic but is being used in
      a context that expects an expression of type s64.  Fix this by
      generating a mask using GENMASK to avoid a 32 bit overflow.
      
      Addresses-Coverity: ("Unintentional integer overflow")
      
      Fixes: 8a99e9fa ("media: vivid: add HDMI (dis)connect RX emulation")
      Fixes: 79a792da ("media: vivid: add HDMI (dis)connect TX emulation")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      b98fd3cb
  9. 22 6月, 2019 9 次提交
  10. 06 6月, 2019 1 次提交
  11. 05 6月, 2019 1 次提交
  12. 24 5月, 2019 1 次提交
    • B
      media: remove redundant 'default n' from Kconfig-s · 2f39cce9
      Bartlomiej Zolnierkiewicz 提交于
      'default n' is the default value for any bool or tristate Kconfig
      setting so there is no need to write it explicitly.
      
      Also since commit f467c564 ("kconfig: only write '# CONFIG_FOO
      is not set' for visible symbols") the Kconfig behavior is the same
      regardless of 'default n' being present or not:
      
          ...
          One side effect of (and the main motivation for) this change is making
          the following two definitions behave exactly the same:
      
              config FOO
                      bool
      
              config FOO
                      bool
                      default n
      
          With this change, neither of these will generate a
          '# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
          That might make it clearer to people that a bare 'default n' is
          redundant.
          ...
      Signed-off-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      2f39cce9
  13. 21 5月, 2019 1 次提交
  14. 22 4月, 2019 1 次提交
  15. 29 3月, 2019 1 次提交
  16. 20 3月, 2019 2 次提交
  17. 19 2月, 2019 2 次提交
  18. 08 2月, 2019 1 次提交
  19. 31 1月, 2019 2 次提交
  20. 17 1月, 2019 3 次提交
  21. 07 12月, 2018 1 次提交
  22. 04 12月, 2018 2 次提交