1. 28 Jan, 2016 5 commits
    • Antonio Ospite's avatar
      [media] gspca: ov534/topro: prevent a division by 0 · 1b95acb2
      Antonio Ospite authored
      commit dcc7fdbe upstream.
      
      v4l2-compliance sends a zeroed struct v4l2_streamparm in
      v4l2-test-formats.cpp::testParmType(), and this results in a division by
      0 in some gspca subdrivers:
      
        divide error: 0000 [#1] SMP
        Modules linked in: gspca_ov534 gspca_main ...
        CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
        Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
          ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
        task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
        RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
        RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
        RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
        RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
        RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
        R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
        R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
        FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
        Stack:
         ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
         ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
         ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
        Call Trace:
         [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
         [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
         [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
         [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
         [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
         [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
         [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
         [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
         [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
         [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
         [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
         [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
        Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
          00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
          76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
        RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
         RSP <ffff880095c4fce8>
        ---[ end trace 279710c2c6c72080 ]---
      
      Following what the doc says about a zeroed timeperframe (see
      http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):
      
        ...
        To reset manually applications can just set this field to zero.
      
      fix the issue by resetting the frame rate to a default value in case of
      an unusable timeperframe.
      
      The fix is done in the subdrivers instead of gspca.c because only the
      subdrivers have notion of a default frame rate to reset the camera to.
      Signed-off-by: default avatarAntonio Ospite <ao2@ao2.it>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1b95acb2
    • Hans Verkuil's avatar
      [media] vb2: fix a regression in poll() behavior for output,streams · 26b557e4
      Hans Verkuil authored
      commit 4623e596 upstream.
      
      In the 3.17 kernel the poll() behavior changed for output streams:
      as long as not all buffers were queued up poll() would return that
      userspace can write. This is fine for the write() call, but when
      using stream I/O this changed the behavior since the expectation
      was that it would wait for buffers to become available for dequeuing.
      
      This patch only enables the check whether you can queue buffers
      for file I/O only, and skips it for stream I/O.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      [ kamal: backport to 4.2-stable: file rename; context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      26b557e4
    • Vito Caputo's avatar
      ovl: use a minimal buffer in ovl_copy_xattr · a541b8ac
      Vito Caputo authored
      commit e4ad29fa upstream.
      
      Rather than always allocating the high-order XATTR_SIZE_MAX buffer
      which is costly and prone to failure, only allocate what is needed and
      realloc if necessary.
      
      Fixes https://github.com/coreos/bugs/issues/489Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a541b8ac
    • Miklos Szeredi's avatar
      ovl: allow zero size xattr · 4c5fbe5f
      Miklos Szeredi authored
      commit 97daf8b9 upstream.
      
      When ovl_copy_xattr() encountered a zero size xattr no more xattrs were
      copied and the function returned success.  This is clearly not the desired
      behavior.
      Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      4c5fbe5f
    • David Hildenbrand's avatar
      hotplugcpu: Avoid deadlocks by waking active_writer · b3e0811f
      David Hildenbrand authored
      commit 87af9e7f upstream.
      
      Commit b2c4623d ("rcu: More on deadlock between CPU hotplug and expedited
      grace periods") introduced another problem that can easily be reproduced by
      starting/stopping cpus in a loop.
      
      E.g.:
        for i in `seq 5000`; do
            echo 1 > /sys/devices/system/cpu/cpu1/online
            echo 0 > /sys/devices/system/cpu/cpu1/online
        done
      
      Will result in:
        INFO: task /cpu_start_stop:1 blocked for more than 120 seconds.
        Call Trace:
        ([<00000000006a028e>] __schedule+0x406/0x91c)
         [<0000000000130f60>] cpu_hotplug_begin+0xd0/0xd4
         [<0000000000130ff6>] _cpu_up+0x3e/0x1c4
         [<0000000000131232>] cpu_up+0xb6/0xd4
         [<00000000004a5720>] device_online+0x80/0xc0
         [<00000000004a57f0>] online_store+0x90/0xb0
        ...
      
      And a deadlock.
      
      Problem is that if the last ref in put_online_cpus() can't get the
      cpu_hotplug.lock the puts_pending count is incremented, but a sleeping
      active_writer might never be woken up, therefore never exiting the loop in
      cpu_hotplug_begin().
      
      This fix removes puts_pending and turns refcount into an atomic variable. We
      also introduce a wait queue for the active_writer, to avoid possible races and
      use-after-free. There is no need to take the lock in put_online_cpus() anymore.
      
      Can't reproduce it with this fix.
      Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      b3e0811f
  2. 26 Jan, 2016 1 commit
  3. 22 Jan, 2016 2 commits
    • Nikolay Aleksandrov's avatar
      net: ipmr: fix static mfc/dev leaks on table destruction · 8a2fe4b0
      Nikolay Aleksandrov authored
      commit 0e615e96 upstream.
      
      When destroying an mrt table the static mfc entries and the static
      devices are kept, which leads to devices that can never be destroyed
      (because of refcnt taken) and leaked memory, for example:
      unreferenced object 0xffff880034c144c0 (size 192):
        comm "mfc-broken", pid 4777, jiffies 4320349055 (age 46001.964s)
        hex dump (first 32 bytes):
          98 53 f0 34 00 88 ff ff 98 53 f0 34 00 88 ff ff  .S.4.....S.4....
          ef 0a 0a 14 01 02 03 04 00 00 00 00 01 00 00 00  ................
        backtrace:
          [<ffffffff815c1b9e>] kmemleak_alloc+0x4e/0xb0
          [<ffffffff811ea6e0>] kmem_cache_alloc+0x190/0x300
          [<ffffffff815931cb>] ip_mroute_setsockopt+0x5cb/0x910
          [<ffffffff8153d575>] do_ip_setsockopt.isra.11+0x105/0xff0
          [<ffffffff8153e490>] ip_setsockopt+0x30/0xa0
          [<ffffffff81564e13>] raw_setsockopt+0x33/0x90
          [<ffffffff814d1e14>] sock_common_setsockopt+0x14/0x20
          [<ffffffff814d0b51>] SyS_setsockopt+0x71/0xc0
          [<ffffffff815cdbf6>] entry_SYSCALL_64_fastpath+0x16/0x7a
          [<ffffffffffffffff>] 0xffffffffffffffff
      
      Make sure that everything is cleaned on netns destruction.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Reviewed-by: default avatarCong Wang <cwang@twopensource.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      8a2fe4b0
    • Kamal Mostafa's avatar
      Linux 3.19.8-ckt13 · 137baa87
      Kamal Mostafa authored
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      137baa87
  4. 20 Jan, 2016 32 commits