1. 05 10月, 2017 8 次提交
  2. 05 9月, 2017 1 次提交
    • S
      media: Revert "[media] lirc_dev: remove superfluous get/put_device() calls" · a607f51e
      Sean Young 提交于
      This reverts commit 5be2b76a.
      
      Only when the lirc device is freed, should we drop our reference to
      rc_dev, else we the rc_dev is freed to early. If userspace has
      a file descriptor open during unplug, it goes bang.
      
      ==================================================================
      BUG: KASAN: use-after-free in __lock_acquire+0x7bb/0x1e10
      Read of size 8 at addr ffff8801d7d61ed0 by task ir-rec/2609
      
      -snip-
       mutex_lock_nested+0x1b/0x20
       ? mutex_lock_nested+0x1b/0x20
       rc_close.part.6+0x20/0x60 [rc_core]
       rc_close+0x13/0x20 [rc_core]
       lirc_dev_fop_close+0x62/0xd0 [lirc_dev]
       __fput+0x236/0x410
       ? fput+0xb0/0xb0
       ? do_raw_spin_trylock+0x110/0x110
       ? set_rq_offline.part.70+0xa0/0xa0
       ____fput+0xe/0x10
       task_work_run+0x116/0x180
       ? task_work_cancel+0x170/0x170
       ? _raw_spin_unlock+0x27/0x40
       ? switch_task_namespaces+0x5f/0x90
       do_exit+0x68b/0xe80
      
      Cc: stable@vger.kernel.org # For Kernel 4.13
      Fixes: 5be2b76a ("[media] lirc_dev: remove superfluous get/put_device() calls")
      Signed-off-by: NSean Young <sean@mess.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
      a607f51e
  3. 06 6月, 2017 10 次提交
  4. 18 5月, 2017 1 次提交
    • D
      [media] ir-lirc-codec: let lirc_dev handle the lirc_buffer · 0f7c4063
      David Härdeman 提交于
      ir_lirc_register() currently creates its own lirc_buffer before
      passing the lirc_driver to lirc_register_driver().
      
      When a module is later unloaded, ir_lirc_unregister() gets called
      which performs a call to lirc_unregister_driver() and then free():s
      the lirc_buffer.
      
      The problem is that:
      
      a) there can still be a userspace app holding an open lirc fd
         when lirc_unregister_driver() returns; and
      
      b) the lirc_buffer contains "wait_queue_head_t wait_poll" which
         is potentially used as long as any userspace app is still around.
      
      The result is an oops which can be triggered quite easily by a
      userspace app monitoring its lirc fd using epoll() and not closing
      the fd promptly on device removal.
      
      The minimalistic fix is to let lirc_dev create the lirc_buffer since
      lirc_dev will then also free the buffer once it believes it is safe to
      do so.
      Signed-off-by: NDavid Härdeman <david@hardeman.nu>
      Signed-off-by: NSean Young <sean@mess.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
      0f7c4063
  5. 24 3月, 2017 2 次提交
  6. 03 3月, 2017 1 次提交
    • S
      [media] lirc: fix dead lock between open and wakeup_filter · db5b15b7
      Sean Young 提交于
      The locking in lirc needs improvement, but for now just fix this potential
      deadlock.
      
      ======================================================
      [ INFO: possible circular locking dependency detected ]
      4.10.0-rc1+ #1 Not tainted
      -------------------------------------------------------
      bash/2502 is trying to acquire lock:
       (ir_raw_handler_lock){+.+.+.}, at: [<ffffffffc06f6a5e>] ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
      
                     but task is already holding lock:
       (&dev->lock){+.+.+.}, at: [<ffffffffc06f511f>] store_filter+0x9f/0x240 [rc_core]
      
                     which lock already depends on the new lock.
      
                     the existing dependency chain (in reverse order) is:
      
                     -> #2 (&dev->lock){+.+.+.}:
      
      [<ffffffffa110adad>] lock_acquire+0xfd/0x200
      [<ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
      [<ffffffffc06f436a>] rc_open+0x2a/0x80 [rc_core]
      [<ffffffffc07114ca>] lirc_dev_fop_open+0xda/0x1e0 [lirc_dev]
      [<ffffffffa12975e0>] chrdev_open+0xb0/0x210
      [<ffffffffa128eb5a>] do_dentry_open+0x20a/0x2f0
      [<ffffffffa128ffcc>] vfs_open+0x4c/0x80
      [<ffffffffa12a35ec>] path_openat+0x5bc/0xc00
      [<ffffffffa12a5271>] do_filp_open+0x91/0x100
      [<ffffffffa12903f0>] do_sys_open+0x130/0x220
      [<ffffffffa12904fe>] SyS_open+0x1e/0x20
      [<ffffffffa19278c1>] entry_SYSCALL_64_fastpath+0x1f/0xc2
                     -> #1 (lirc_dev_lock){+.+.+.}:
      [<ffffffffa110adad>] lock_acquire+0xfd/0x200
      [<ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
      [<ffffffffc0711f47>] lirc_register_driver+0x67/0x59b [lirc_dev]
      [<ffffffffc06db7f4>] ir_lirc_register+0x1f4/0x260 [ir_lirc_codec]
      [<ffffffffc06f6cac>] ir_raw_handler_register+0x7c/0xb0 [rc_core]
      [<ffffffffc0398010>] 0xffffffffc0398010
      [<ffffffffa1002192>] do_one_initcall+0x52/0x1b0
      [<ffffffffa11ef5c8>] do_init_module+0x5f/0x1fa
      [<ffffffffa11566b5>] load_module+0x2675/0x2b00
      [<ffffffffa1156dcf>] SYSC_finit_module+0xdf/0x110
      [<ffffffffa1156e1e>] SyS_finit_module+0xe/0x10
      [<ffffffffa1003f5c>] do_syscall_64+0x6c/0x1f0
      [<ffffffffa1927989>] return_from_SYSCALL_64+0x0/0x7a
                     -> #0 (ir_raw_handler_lock){+.+.+.}:
      [<ffffffffa110a7b7>] __lock_acquire+0x10f7/0x1290
      [<ffffffffa110adad>] lock_acquire+0xfd/0x200
      [<ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
      [<ffffffffc06f6a5e>] ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
      [<ffffffffc0b0f492>] loop_set_wakeup_filter+0x62/0xbd [rc_loopback]
      [<ffffffffc06f522a>] store_filter+0x1aa/0x240 [rc_core]
      [<ffffffffa15e46f8>] dev_attr_store+0x18/0x30
      [<ffffffffa13318e5>] sysfs_kf_write+0x45/0x60
      [<ffffffffa1330b55>] kernfs_fop_write+0x155/0x1e0
      [<ffffffffa1290797>] __vfs_write+0x37/0x160
      [<ffffffffa12921f8>] vfs_write+0xc8/0x1e0
      [<ffffffffa12936e8>] SyS_write+0x58/0xc0
      [<ffffffffa19278c1>] entry_SYSCALL_64_fastpath+0x1f/0xc2
      
                     other info that might help us debug this:
      
      Chain exists of:
                       ir_raw_handler_lock --> lirc_dev_lock --> &dev->lock
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&dev->lock);
                                     lock(lirc_dev_lock);
                                     lock(&dev->lock);
        lock(ir_raw_handler_lock);
      
                      *** DEADLOCK ***
      
      4 locks held by bash/2502:
       #0:  (sb_writers#4){.+.+.+}, at: [<ffffffffa12922c5>] vfs_write+0x195/0x1e0
       #1:  (&of->mutex){+.+.+.}, at: [<ffffffffa1330b1f>] kernfs_fop_write+0x11f/0x1e0
       #2:  (s_active#215){.+.+.+}, at: [<ffffffffa1330b28>] kernfs_fop_write+0x128/0x1e0
       #3:  (&dev->lock){+.+.+.}, at: [<ffffffffc06f511f>] store_filter+0x9f/0x240 [rc_core]
      
                     stack backtrace:
      CPU: 3 PID: 2502 Comm: bash Not tainted 4.10.0-rc1+ #1
      Hardware name:                  /DG45ID, BIOS IDG4510H.86A.0135.2011.0225.1100 02/25/2011
      Call Trace:
       dump_stack+0x86/0xc3
       print_circular_bug+0x1be/0x210
       __lock_acquire+0x10f7/0x1290
       lock_acquire+0xfd/0x200
       ? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
       ? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
       mutex_lock_nested+0x77/0x6d0
       ? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
       ? loop_set_wakeup_filter+0x44/0xbd [rc_loopback]
       ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
       loop_set_wakeup_filter+0x62/0xbd [rc_loopback]
       ? loop_set_tx_duty_cycle+0x70/0x70 [rc_loopback]
       store_filter+0x1aa/0x240 [rc_core]
       dev_attr_store+0x18/0x30
       sysfs_kf_write+0x45/0x60
       kernfs_fop_write+0x155/0x1e0
       __vfs_write+0x37/0x160
       ? rcu_read_lock_sched_held+0x4a/0x80
       ? rcu_sync_lockdep_assert+0x2f/0x60
       ? __sb_start_write+0x10c/0x220
       ? vfs_write+0x195/0x1e0
       ? security_file_permission+0x3b/0xc0
       vfs_write+0xc8/0x1e0
       SyS_write+0x58/0xc0
       entry_SYSCALL_64_fastpath+0x1f/0xc2
      Signed-off-by: NSean Young <sean@mess.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
      db5b15b7
  7. 02 3月, 2017 1 次提交
  8. 04 2月, 2017 1 次提交
  9. 31 1月, 2017 1 次提交
  10. 30 1月, 2017 1 次提交
  11. 27 1月, 2017 1 次提交
    • S
      [media] media: Drop FSF's postal address from the source code files · bcb63314
      Sakari Ailus 提交于
      Drop the FSF's postal address from the source code files that typically
      contain mostly the license text. Of the 628 removed instances, 578 are
      outdated.
      
      The patch has been created with the following command without manual edits:
      
      git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \
      	drivers/media/ include/media|while read i; do i=$i perl -e '
      open(F,"< $ENV{i}");
      $a=join("", <F>);
      $a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m
      	&& $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, $2\n$1/m;
      close(F);
      open(F, "> $ENV{i}");
      print F $a;
      close(F);'; done
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      bcb63314
  12. 01 12月, 2016 1 次提交
  13. 21 11月, 2016 3 次提交
  14. 19 11月, 2016 1 次提交
  15. 14 7月, 2016 7 次提交