1. 27 Sep, 2013 40 commits
    • Libin's avatar
      mm/huge_memory.c: fix potential NULL pointer dereference · 8b89ae8a
      Libin authored
      commit a8f531eb upstream.
      
      In collapse_huge_page() there is a race window between releasing the
      mmap_sem read lock and taking the mmap_sem write lock, so find_vma() may
      return NULL.  So check the return value to avoid NULL pointer dereference.
      
      collapse_huge_page
      	khugepaged_alloc_page
      		up_read(&mm->mmap_sem)
      	down_write(&mm->mmap_sem)
      	vma = find_vma(mm, address)
      Signed-off-by: default avatarLibin <huawei.libin@huawei.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b89ae8a
    • Greg Thelen's avatar
      memcg: fix multiple large threshold notifications · d96fa179
      Greg Thelen authored
      commit 2bff24a3 upstream.
      
      A memory cgroup with (1) multiple threshold notifications and (2) at least
      one threshold >=2G was not reliable.  Specifically the notifications would
      either not fire or would not fire in the proper order.
      
      The __mem_cgroup_threshold() signaling logic depends on keeping 64 bit
      thresholds in sorted order.  mem_cgroup_usage_register_event() sorts them
      with compare_thresholds(), which returns the difference of two 64 bit
      thresholds as an int.  If the difference is positive but has bit[31] set,
      then sort() treats the difference as negative and breaks sort order.
      
      This fix compares the two arbitrary 64 bit thresholds returning the
      classic -1, 0, 1 result.
      
      The test below sets two notifications (at 0x1000 and 0x81001000):
        cd /sys/fs/cgroup/memory
        mkdir x
        for x in 4096 2164264960; do
          cgroup_event_listener x/memory.usage_in_bytes $x | sed "s/^/$x listener:/" &
        done
        echo $$ > x/cgroup.procs
        anon_leaker 500M
      
      v3.11-rc7 fails to signal the 4096 event listener:
        Leaking...
        Done leaking pages.
      
      Patched v3.11-rc7 properly notifies:
        Leaking...
        4096 listener:2013:8:31:14:13:36
        Done leaking pages.
      
      The fixed bug is old.  It appears to date back to the introduction of
      memcg threshold notifications in v2.6.34-rc1-116-g2e72b634 "memcg:
      implement memory thresholds"
      Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d96fa179
    • Jie Liu's avatar
      ocfs2: fix the end cluster offset of FIEMAP · 3c46f726
      Jie Liu authored
      commit 28e8be31 upstream.
      
      Call fiemap ioctl(2) with given start offset as well as an desired mapping
      range should show extents if possible.  However, we somehow figure out the
      end offset of mapping via 'mapping_end -= cpos' before iterating the
      extent records which would cause problems if the given fiemap length is
      too small to a cluster size, e.g,
      
      Cluster size 4096:
      debugfs.ocfs2 1.6.3
              Block Size Bits: 12   Cluster Size Bits: 12
      
      The extended fiemap test utility From David:
      https://gist.github.com/anonymous/6172331
      
      # dd if=/dev/urandom of=/ocfs2/test_file bs=1M count=1000
      # ./fiemap /ocfs2/test_file 4096 10
      start: 4096, length: 10
      File /ocfs2/test_file has 0 extents:
      #	Logical          Physical         Length           Flags
      	^^^^^ <-- No extent is shown
      
      In this case, at ocfs2_fiemap(): cpos == mapping_end == 1. Hence the
      loop of searching extent records was not executed at all.
      
      This patch remove the in question 'mapping_end -= cpos', and loops
      until the cpos is larger than the mapping_end as usual.
      
      # ./fiemap /ocfs2/test_file 4096 10
      start: 4096, length: 10
      File /ocfs2/test_file has 1 extents:
      #	Logical          Physical         Length           Flags
      0:	0000000000000000 0000000056a01000 0000000006a00000 0000
      Signed-off-by: default avatarJie Liu <jeff.liu@oracle.com>
      Reported-by: default avatarDavid Weber <wb@munzinger.de>
      Tested-by: default avatarDavid Weber <wb@munzinger.de>
      Cc: Sunil Mushran <sunil.mushran@gmail.com>
      Cc: Mark Fashen <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c46f726
    • Oleg Nesterov's avatar
      pidns: fix vfork() after unshare(CLONE_NEWPID) · f608ebd7
      Oleg Nesterov authored
      commit e79f525e upstream.
      
      Commit 8382fcac ("pidns: Outlaw thread creation after
      unshare(CLONE_NEWPID)") nacks CLONE_VM if the forking process unshared
      pid_ns, this obviously breaks vfork:
      
      	int main(void)
      	{
      		assert(unshare(CLONE_NEWUSER | CLONE_NEWPID) == 0);
      		assert(vfork() >= 0);
      		_exit(0);
      		return 0;
      	}
      
      fails without this patch.
      
      Change this check to use CLONE_SIGHAND instead.  This also forbids
      CLONE_THREAD automatically, and this is what the comment implies.
      
      We could probably even drop CLONE_SIGHAND and use CLONE_THREAD, but it
      would be safer to not do this.  The current check denies CLONE_SIGHAND
      implicitely and there is no reason to change this.
      
      Eric said "CLONE_SIGHAND is fine.  CLONE_THREAD would be even better.
      Having shared signal handling between two different pid namespaces is
      the case that we are fundamentally guarding against."
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reported-by: default avatarColin Walters <walters@redhat.com>
      Acked-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Reviewed-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f608ebd7
    • Eric W. Biederman's avatar
      pidns: Fix hang in zap_pid_ns_processes by sending a potentially extra wakeup · 5a48788c
      Eric W. Biederman authored
      commit a6064885 upstream.
      
      Serge Hallyn <serge.hallyn@ubuntu.com> writes:
      
      > Since commit af4b8a83 it's been
      > possible to get into a situation where a pidns reaper is
      > <defunct>, reparented to host pid 1, but never reaped.  How to
      > reproduce this is documented at
      >
      > https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1168526
      > (and see
      > https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1168526/comments/13)
      > In short, run repeated starts of a container whose init is
      >
      > Process.exit(0);
      >
      > sysrq-t when such a task is playing zombie shows:
      >
      > [  131.132978] init            x ffff88011fc14580     0  2084   2039 0x00000000
      > [  131.132978]  ffff880116e89ea8 0000000000000002 ffff880116e89fd8 0000000000014580
      > [  131.132978]  ffff880116e89fd8 0000000000014580 ffff8801172a0000 ffff8801172a0000
      > [  131.132978]  ffff8801172a0630 ffff88011729fff0 ffff880116e14650 ffff88011729fff0
      > [  131.132978] Call Trace:
      > [  131.132978]  [<ffffffff816f6159>] schedule+0x29/0x70
      > [  131.132978]  [<ffffffff81064591>] do_exit+0x6e1/0xa40
      > [  131.132978]  [<ffffffff81071eae>] ? signal_wake_up_state+0x1e/0x30
      > [  131.132978]  [<ffffffff8106496f>] do_group_exit+0x3f/0xa0
      > [  131.132978]  [<ffffffff810649e4>] SyS_exit_group+0x14/0x20
      > [  131.132978]  [<ffffffff8170102f>] tracesys+0xe1/0xe6
      >
      > Further debugging showed that every time this happened, zap_pid_ns_processes()
      > started with nr_hashed being 3, while we were expecting it to drop to 2.
      > Any time it didn't happen, nr_hashed was 1 or 2.  So the reaper was
      > waiting for nr_hashed to become 2, but free_pid() only wakes the reaper
      > if nr_hashed hits 1.
      
      The issue is that when the task group leader of an init process exits
      before other tasks of the init process when the init process finally
      exits it will be a secondary task sleeping in zap_pid_ns_processes and
      waiting to wake up when the number of hashed pids drops to two.  This
      case waits forever as free_pid only sends a wake up when the number of
      hashed pids drops to 1.
      
      To correct this the simple strategy of sending a possibly unncessary
      wake up when the number of hashed pids drops to 2 is adopted.
      
      Sending one extraneous wake up is relatively harmless, at worst we
      waste a little cpu time in the rare case when a pid namespace
      appropaches exiting.
      
      We can detect the case when the pid namespace drops to just two pids
      hashed race free in free_pid.
      
      Dereferencing pid_ns->child_reaper with the pidmap_lock held is safe
      without out the tasklist_lock because it is guaranteed that the
      detach_pid will be called on the child_reaper before it is freed and
      detach_pid calls __change_pid which calls free_pid which takes the
      pidmap_lock.  __change_pid only calls free_pid if this is the
      last use of the pid.  For a thread that is not the thread group leader
      the threads pid will only ever have one user because a threads pid
      is not allowed to be the pid of a process, of a process group or
      a session.  For a thread that is a thread group leader all of
      the other threads of that process will be reaped before it is allowed
      for the thread group leader to be reaped ensuring there will only
      be one user of the threads pid as a process pid.  Furthermore
      because the thread is the init process of a pid namespace all of the
      other processes in the pid namespace will have also been already freed
      leading to the fact that the pid will not be used as a session pid or
      a process group pid for any other running process.
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Tested-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Reported-by: default avatarSerge Hallyn <serge.hallyn@ubuntu.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a48788c
    • Alex Williamson's avatar
      intel-iommu: Fix leaks in pagetable freeing · 1b24e0e4
      Alex Williamson authored
      commit 3269ee0b upstream.
      
      At best the current code only seems to free the leaf pagetables and
      the root.  If you're unlucky enough to have a large gap (like any
      QEMU guest with more than 3G of memory), only the first chunk of leaf
      pagetables are freed (plus the root).  This is a massive memory leak.
      This patch re-writes the pagetable freeing function to use a
      recursive algorithm and manages to not only free all the pagetables,
      but does it without any apparent performance loss versus the current
      broken version.
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b24e0e4
    • Gera Kazakov's avatar
      target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out · e041da06
      Gera Kazakov authored
      commit f730f915 upstream.
      
      This patch fixes a >= v3.9+ regression in __core_scsi3_write_aptpl_to_file()
      + core_alua_write_tpg_metadata() write-out, where a return value of -EIO was
      incorrectly being returned upon success.
      
      This bug was originally introduced in:
      
      commit 0e9b10a9
      Author: Al Viro <viro@zeniv.linux.org.uk>
      Date:   Sat Feb 23 15:22:43 2013 -0500
      
          target: writev() on single-element vector is pointless
      
      However, given that the return of core_scsi3_update_and_write_aptpl()
      was not used to determine if a command should be returned with non GOOD
      status, this bug was not being triggered in PR logic until v3.11-rc1 by
      commit:
      
      commit 459f213b
      Author: Andy Grover <agrover@redhat.com>
      Date:   Thu May 16 10:41:02 2013 -0700
      
          target: Allocate aptpl_buf inside update_and_write_aptpl()
      
      So, go ahead and only return -EIO if kernel_write() returned a
      negative value.
      Reported-by: default avatarGera Kazakov <gkazakov@msn.com>
      Signed-off-by: default avatarGera Kazakov <gkazakov@msn.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e041da06
    • Felix Fietkau's avatar
      MIPS: ath79: Fix ar933x watchdog clock · 2008c41d
      Felix Fietkau authored
      commit a1191927 upstream.
      
      The watchdog device on the AR933x is connected to
      the AHB clock, however the current code uses the
      reference clock. Due to the wrong rate, the watchdog
      driver can't calculate correct register values for
      a given timeout value and the watchdog unexpectedly
      restarts the system.
      
      The code uses the wrong value since the initial
      commit 04225e1d
      (MIPS: ath79: add AR933X specific clock init)
      
      The patch fixes the code to use the correct clock
      rate to avoid the problem.
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/5777/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2008c41d
    • Mark Brown's avatar
      leds: wm831x-status: Request a REG resource · d041e861
      Mark Brown authored
      commit 61abeba5 upstream.
      
      The wm831x-status driver was not converted to use a REG resource when they
      were introduced and the rest of the wm831x drivers converted, causing it
      to fail to probe due to requesting the wrong resource type.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d041e861
    • Oleg Nesterov's avatar
      uprobes: Fix utask->depth accounting in handle_trampoline() · 73e2c2b7
      Oleg Nesterov authored
      commit 878b5a6e upstream.
      
      Currently utask->depth is simply the number of allocated/pending
      return_instance's in uprobe_task->return_instances list.
      
      handle_trampoline() should decrement this counter every time we
      handle/free an instance, but due to typo it does this only if
      ->chained == T. This means that in the likely case this counter
      is never decremented and the probed task can't report more than
      MAX_URETPROBE_DEPTH events.
      Reported-by: default avatarMikhail Kulemin <Mikhail.Kulemin@ru.ibm.com>
      Reported-by: default avatarHemant Kumar Shaw <hkshaw@linux.vnet.ibm.com>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarAnton Arapov <anton@redhat.com>
      Cc: masami.hiramatsu.pt@hitachi.com
      Cc: srikar@linux.vnet.ibm.com
      Cc: systemtap@sourceware.org
      Link: http://lkml.kernel.org/r/20130911154726.GA8093@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73e2c2b7
    • Stefan Behrens's avatar
      Btrfs: don't allow the replace procedure on read only filesystems · 42cc8e56
      Stefan Behrens authored
      commit bbb651e4 upstream.
      
      If you start the replace procedure on a read only filesystem, at
      the end the procedure fails to write the updated dev_items to the
      chunk tree. The problem is that this error is not indicated except
      for a WARN_ON(). If the user now thinks that everything was done
      as expected and destroys the source device (with mkfs or with a
      hammer). The next mount fails with "failed to read chunk root" and
      the filesystem is gone.
      
      This commit adds code to fail the attempt to start the replace
      procedure if the filesystem is mounted read-only.
      Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42cc8e56
    • Bjørn Mork's avatar
      media: siano: fix divide error on 0 counters · d2310f71
      Bjørn Mork authored
      commit ec532503 upstream.
      
      GIT_AUTHOR_DATE=1376465691
      I took a quick look at the code and wonder if the problem is caused by
      an initial zero statistics message?  This is all just a wild guess, but
      if it is correct, then the attached untested patch might fix it...
      Bjørn
      >From d78a0599d5b5d4da384eae08bf7da316389dfbe5 Mon Sep 17 00:00:00 2001
      ts_packets and ets_packets counters can be 0.  Don't fall over
      if they are. Fixes:
      [  846.851711] divide error: 0000 [#1] SMP
      [  846.851806] Modules linked in: smsdvb dvb_core ir_lirc_codec lirc_dev ir_sanyo_decoder ir_mce_kbd_decoder ir_sony_decoder ir_jvc_decoder ir_rc6_decoder ir_rc5_decoder ir_nec_decoder rc_hauppauge smsusb smsmdtv rc_core pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) parport_pc ppdev lp parport cpufreq_userspace cpufreq_powersave cpufreq_stats cpufreq_conservative rfcomm bnep binfmt_misc uinput nfsd auth_rpcgss oid_registry nfs_acl nfs lockd dns_resolver fscache sunrpc ext4 jbd2 fuse tp_smapi(O) thinkpad_ec(O) loop firewire_sbp2 dm_crypt snd_hda_codec_conexant snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm thinkpad_acpi nvram snd_page_alloc hid_generic snd_seq_midi snd_seq_midi_event arc4 usbhid snd_rawmidi uvcvideo hid iwldvm coretemp kvm_intel mac8021
       1 cdc_wdm
      [  846.853477]  cdc_acm snd_seq videobuf2_vmalloc videobuf2_memops videobuf2_core videodev media kvm radeon r852 ttm joydev cdc_ether usbnet pcmcia mii sm_common nand btusb drm_kms_helper tpm_tis acpi_cpufreq bluetooth iwlwifi nand_ecc drm nand_ids i2c_i801 mtd snd_seq_device iTCO_wdt iTCO_vendor_support r592 memstick lpc_ich mperf tpm yenta_socket pcmcia_rsrc pcmcia_core cfg80211 snd_timer snd pcspkr i2c_algo_bit crc16 i2c_core tpm_bios processor mfd_core wmi psmouse mei_me rfkill mei serio_raw soundcore evdev battery button video ac microcode ext3 mbcache jbd md_mod dm_mirror dm_region_hash dm_log dm_mod sg sr_mod sd_mod cdrom crc_t10dif firewire_ohci sdhci_pci sdhci mmc_core firewire_core crc_itu_t thermal thermal_sys ahci libahci ehci_pci uhci_hcd ehci_hcd libata scsi_mod usbcore e1000
       e usb_common
      [  846.855310]  ptp pps_core
      [  846.855356] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O 3.10-2-amd64 #1 Debian 3.10.5-1
      [  846.855490] Hardware name: LENOVO 4061WFA/4061WFA, BIOS 6FET92WW (3.22 ) 12/14/2011
      [  846.855609] task: ffffffff81613400 ti: ffffffff81600000 task.ti: ffffffff81600000
      [  846.855636] RIP: 0010:[<ffffffffa092be0c>]  [<ffffffffa092be0c>] smsdvb_onresponse+0x264/0xa86 [smsdvb]
      [  846.863906] RSP: 0018:ffff88013bc03cf0  EFLAGS: 00010046
      [  846.863906] RAX: 0000000000000000 RBX: ffff880133bf6000 RCX: 0000000000000000
      [  846.863906] RDX: 0000000000000000 RSI: ffff88005d3b58c0 RDI: ffff880133bf6000
      [  846.863906] RBP: ffff88005d1da000 R08: 0000000000000058 R09: 0000000000000015
      [  846.863906] R10: 0000000000001a0d R11: 000000000000021a R12: ffff88005d3b58c0
      [  846.863906] R13: ffff88005d1da008 R14: 00000000ffffff8d R15: ffff880036cf5060
      [  846.863906] FS:  0000000000000000(0000) GS:ffff88013bc00000(0000) knlGS:0000000000000000
      [  846.863906] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [  846.863906] CR2: 00007f3a4b69ae50 CR3: 0000000036dac000 CR4: 00000000000407f0
      [  846.863906] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  846.863906] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  846.863906] Stack:
      [  846.863906]  ffff88007a102000 ffff88005d1da000 ffff88005d3b58c0 0000000000085824
      [  846.863906]  ffffffffa08c5aa3 ffff88005d1da000 ffff8800a6907390 ffff8800a69073b0
      [  846.863906]  ffff8800a6907000 ffffffffa08b642c 000000000000021a ffff8800a69073b0
      [  846.863906] Call Trace:
      [  846.863906]  <IRQ>
      [  846.863906]
      [  846.863906]  [<ffffffffa08c5aa3>] ? smscore_onresponse+0x1d5/0x353 [smsmdtv]
      [  846.863906]  [<ffffffffa08b642c>] ? smsusb_onresponse+0x146/0x192 [smsusb]
      [  846.863906]  [<ffffffffa004cb1a>] ? usb_hcd_giveback_urb+0x6c/0xac [usbcore]
      [  846.863906]  [<ffffffffa0217be1>] ? ehci_urb_done+0x62/0x72 [ehci_hcd]
      [  846.863906]  [<ffffffffa0217c82>] ? qh_completions+0x91/0x364 [ehci_hcd]
      [  846.863906]  [<ffffffffa0219bba>] ? ehci_work+0x8a/0x68e [ehci_hcd]
      [  846.863906]  [<ffffffff8107336c>] ? timekeeping_get_ns.constprop.10+0xd/0x31
      [  846.863906]  [<ffffffff81064d41>] ? update_cfs_rq_blocked_load+0xde/0xec
      [  846.863906]  [<ffffffff81058ec2>] ? run_posix_cpu_timers+0x25/0x575
      [  846.863906]  [<ffffffffa021aa46>] ? ehci_irq+0x211/0x23d [ehci_hcd]
      [  846.863906]  [<ffffffffa004c0c1>] ? usb_hcd_irq+0x31/0x48 [usbcore]
      [  846.863906]  [<ffffffff810996fd>] ? handle_irq_event_percpu+0x49/0x1a4
      [  846.863906]  [<ffffffff8109988a>] ? handle_irq_event+0x32/0x4b
      [  846.863906]  [<ffffffff8109bd76>] ? handle_fasteoi_irq+0x80/0xb6
      [  846.863906]  [<ffffffff8100e93e>] ? handle_irq+0x18/0x20
      [  846.863906]  [<ffffffff8100e657>] ? do_IRQ+0x40/0x95
      [  846.863906]  [<ffffffff813883ed>] ? common_interrupt+0x6d/0x6d
      [  846.863906]  <EOI>
      [  846.863906]
      [  846.863906]  [<ffffffff812a011c>] ? arch_local_irq_enable+0x4/0x8
      [  846.863906]  [<ffffffff812a04f3>] ? cpuidle_enter_state+0x52/0xc1
      [  846.863906]  [<ffffffff812a0636>] ? cpuidle_idle_call+0xd4/0x143
      [  846.863906]  [<ffffffff8101398c>] ? arch_cpu_idle+0x5/0x17
      [  846.863906]  [<ffffffff81072571>] ? cpu_startup_entry+0x10d/0x187
      [  846.863906]  [<ffffffff816b3d3d>] ? start_kernel+0x3e8/0x3f3
      [  846.863906]  [<ffffffff816b3777>] ? repair_env_string+0x54/0x54
      [  846.863906]  [<ffffffff816b3598>] ? x86_64_start_kernel+0xf2/0xfd
      [  846.863906] Code: 25 09 00 00 c6 83 da 08 00 00 03 8b 45 54 48 01 83 b6 08 00 00 8b 45 50 48 01 83 db 08 00 00 8b 4d 18 69 c1 ff ff 00 00 03 4d 14 <48> f7 f1 89 83 a8 09 00 00 e9 68 fe ff ff 48 8b 7f 10 e8 79 92
      [  846.863906] RIP  [<ffffffffa092be0c>] smsdvb_onresponse+0x264/0xa86 [smsdvb]
      [  846.863906]  RSP <ffff88013bc03cf0>
      Reference: http://bugs.debian.org/719623Reported-by: default avatarJohannes Rohr <jorohr@gmail.com>
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2310f71
    • Mauro Carvalho Chehab's avatar
      media: mb86a20s: Fix TS parallel mode · b3fcd91b
      Mauro Carvalho Chehab authored
      commit 9d32069f upstream.
      
      changeset 768e6dad caused a regression on using mb86a20s
      in parallel mode, as the parallel mode selection got
      overriden by mb86a20s_init2.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3fcd91b
    • Alexander Shiyan's avatar
      media: media: coda: Fix DT driver data pointer for i.MX27 · 4ff5ef25
      Alexander Shiyan authored
      commit 7b0dd9e6 upstream.
      
      The data pointer should point to DT data, and not to the ID
      array.
      Signed-off-by: default avatarAlexander Shiyan <shc_work@mail.ru>
      Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ff5ef25
    • Andrzej Hajda's avatar
      media: v4l2: added missing mutex.h include to v4l2-ctrls.h · cd08ebc0
      Andrzej Hajda authored
      commit a19dec6e upstream.
      
      This patch fixes following error:
      include/media/v4l2-ctrls.h:193:15: error: field ‘_lock’ has incomplete type
      include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_lock’:
      include/media/v4l2-ctrls.h:570:2: error: implicit declaration of
      	function ‘mutex_lock’ [-Werror=implicit-function-declaration]
      include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_unlock’:
      include/media/v4l2-ctrls.h:579:2: error: implicit declaration of
      	function ‘mutex_unlock’ [-Werror=implicit-function-declaration]
      Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd08ebc0
    • Alexey Khoroshilov's avatar
      media: hdpvr: fix iteration over uninitialized lists in hdpvr_probe() · ed6db5dc
      Alexey Khoroshilov authored
      commit 2e923a05 upstream.
      
      free_buff_list and rec_buff_list are initialized in the middle of hdpvr_probe(),
      but if something bad happens before that, error handling code calls hdpvr_delete(),
      which contains iteration over the lists (via hdpvr_free_buffers()).
      The patch moves the lists initialization to the beginning and by the way fixes
      goto label in error handling of registering videodev.
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed6db5dc
    • Andrzej Hajda's avatar
      media: DocBook: upgrade media_api DocBook version to 4.2 · bd7dcb5a
      Andrzej Hajda authored
      commit 8bfd4a68 upstream.
      
      Fixes the last three errors of media_api DocBook validatation:
      (...)
      media_api.xml:414: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set
      media_api.xml:432: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set
      media_api.xml:452: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set
      (...)
      Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd7dcb5a
    • Sachin Kamat's avatar
      media: s5p-g2d: Fix registration failure · 469641b2
      Sachin Kamat authored
      commit 8a09a4cc upstream.
      
      Commit 1c1d86a1 ("[media] v4l2: always require v4l2_dev,
      rename parent to dev_parent") expects v4l2_dev to be always set.
      It converted most of the drivers using the parent field of video_device
      to v4l2_dev field. G2D driver did not set the parent field. Hence it got
      left out. Without this patch we get the following boot warning and G2D
      driver fails to register the video device.
      WARNING: CPU: 0 PID: 1 at drivers/media/v4l2-core/v4l2-dev.c:775 __video_register_device+0xfc0/0x1028()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc1-00001-g1c3e372-dirty #9
      [<c0014b7c>] (unwind_backtrace+0x0/0xf4) from [<c0011524>] (show_stack+0x10/0x14)
      [<c0011524>] (show_stack+0x10/0x14) from [<c041d7a8>] (dump_stack+0x7c/0xb0)
      [<c041d7a8>] (dump_stack+0x7c/0xb0) from [<c001dc94>] (warn_slowpath_common+0x6c/0x88)
      [<c001dc94>] (warn_slowpath_common+0x6c/0x88) from [<c001dd4c>] (warn_slowpath_null+0x1c/0x24)
      [<c001dd4c>] (warn_slowpath_null+0x1c/0x24) from [<c02cf8d4>] (__video_register_device+0xfc0/0x1028)
      [<c02cf8d4>] (__video_register_device+0xfc0/0x1028) from [<c0311a94>] (g2d_probe+0x1f8/0x398)
      [<c0311a94>] (g2d_probe+0x1f8/0x398) from [<c0247d54>] (platform_drv_probe+0x14/0x18)
      [<c0247d54>] (platform_drv_probe+0x14/0x18) from [<c0246b10>] (driver_probe_device+0x108/0x220)
      [<c0246b10>] (driver_probe_device+0x108/0x220) from [<c0246cf8>] (__driver_attach+0x8c/0x90)
      [<c0246cf8>] (__driver_attach+0x8c/0x90) from [<c0245050>] (bus_for_each_dev+0x60/0x94)
      [<c0245050>] (bus_for_each_dev+0x60/0x94) from [<c02462c8>] (bus_add_driver+0x1c0/0x24c)
      [<c02462c8>] (bus_add_driver+0x1c0/0x24c) from [<c02472d0>] (driver_register+0x78/0x140)
      [<c02472d0>] (driver_register+0x78/0x140) from [<c00087c8>] (do_one_initcall+0xf8/0x144)
      [<c00087c8>] (do_one_initcall+0xf8/0x144) from [<c05b29e8>] (kernel_init_freeable+0x13c/0x1d8)
      [<c05b29e8>] (kernel_init_freeable+0x13c/0x1d8) from [<c041a108>] (kernel_init+0xc/0x160)
      [<c041a108>] (kernel_init+0xc/0x160) from [<c000e2f8>] (ret_from_fork+0x14/0x3c)
      ---[ end trace 4e0ec028b0028e02 ]---
      s5p-g2d 12800000.g2d: Failed to register video device
      s5p-g2d: probe of 12800000.g2d failed with error -22
      Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
      Cc: Hans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      469641b2
    • Sylwester Nawrocki's avatar
      media: exynos4-is: Fix entity unregistration on error path · cb6ecb39
      Sylwester Nawrocki authored
      commit d2b903b4 upstream.
      
      This patch corrects media entities unregistration order to make sure
      the fimc.N.capture and fimc-lite video nodes are unregistered with
      fimc->lock mutex held. This prevents races between video device open()
      and defered probing and NULL pointer dereference in open() callback
      as follows:
      [   77.645000] Unable to handle kernel NULL pointer dereference at virtual address 00000290t
      [   77.655000] pgd = ee7a8000
      [   77.660000] [00000290] *pgd=6e13c831, *pte=00000000, *ppte=00000000
      [   77.665000] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      [   77.670000] Modules linked in: s5p_fimc ipv6 exynos_fimc_is exynos_fimc_lite
       s5p_csis v4l2_mem2mem videobuf2_dma_contig videobuf2_memops exynos4_is_common videobuf2_core [last unloaded: s5p_fimc]
      [   77.685000] CPU: 0 PID : 2998 Comm: v4l_id Tainted: G        W   3.10.0-next-20130709-00039-g39f491b-dirty #1548
      [   77.695000] task: ee084000 ti: ee46e000 task.ti: ee46e000
      [   77.700000] PC is at __mutex_lock_slowpath+0x54/0x368
      [   77.705000] LR is at __mutex_lock_slowpath+0x24/0x368
      [   77.710000] pc : [<c038dc10>]    lr : [<c038dbe0>]    psr: 60000093
      [   77.710000] sp : ee46fd70  ip : 000008c8  fp : c054e34c
      [   77.725000] r10: ee084000  r9 : 00000000  r8 : ee439480
      [   77.730000] r7 : ee46e000  r6 : 60000013  r5 : 00000290  r4 : 0000028c
      [   77.735000] r3 : 00000000  r2 : 00000000  r1 : 20000093  r0 : 00000001
      [   77.740000] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM Segment user
      [   77.750000] Control: 10c5387d  Table: 6e7a804a  DAC: 00000015
      [   77.755000] Process v4l_id (pid: 2998, stack limit = 0xee46e238)
      [   77.760000] Stack: (0xee46fd70 to 0xee470000)
          	       ...
      [   77.935000] [<c038dc10>] (__mutex_lock_slowpath+0x54/0x368) from [<c038df30>] (mutex_lock+0xc/0x24)
      [   77.945000] [<c038df30>] (mutex_lock+0xc/0x24) from [<bf03fa90>] (fimc_lite_open+0x12c/0x2bc [exynos_fimc_lite])
      [   77.955000] [<bf03fa90>] (fimc_lite_open+0x12c/0x2bc [exynos_fimc_lite]) from [<c02ab11c>] (v4l2_open+0xa0/0xe0)
      [   77.965000] [<c02ab11c>] (v4l2_open+0xa0/0xe0) from [<c00b1de4>] (chrdev_open+0x88/0x170)
      [   77.975000] [<c00b1de4>] (chrdev_open+0x88/0x170) from [<c00ac710>] (do_dentry_open.isra.14+0x1d8/0x258)
      [   77.985000] [<c00ac710>] (do_dentry_open.isra.14+0x1d8/0x258) from [<c00ac860>] (finish_open+0x20/0x38)
      [   77.995000] [<c00ac860>] (finish_open+0x20/0x38) from [<c00ba658>] (do_last.isra.43+0x538/0xb1c)
      [   78.000000] [<c00ba658>] (do_last.isra.43+0x538/0xb1c) from [<c00bacf0>] (path_openat+0xb4/0x5c4)
      [   78.010000] [<c00bacf0>] (path_openat+0xb4/0x5c4) from [<c00bb4b4>] (do_filp_open+0x2c/0x80)
      [   78.020000] [<c00bb4b4>] (do_filp_open+0x2c/0x80) from [<c00ad744>] (do_sys_open+0xf4/0x1a8)
      [   78.025000] [<c00ad744>] (do_sys_open+0xf4/0x1a8) from [<c000e320>] (ret_fast_syscall+0x0/0x30)
      [   78.035000] Code: 1a000093 e10f6000 f10c0080 e2845004 (e1953f9f)
      Reported-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb6ecb39
    • Arun Kumar K's avatar
      media: exynos-gsc: Register v4l2 device · 1d9d780f
      Arun Kumar K authored
      commit d0b1c313 upstream.
      
      Gscaler video device registration was happening without reference to
      a parent v4l2_dev causing probe to fail. The patch creates a parent
      v4l2 device and uses it for the gsc m2m video device registration.
      This fixes regression introduced with comit commit 1c1d86a1
      [media] v4l2: always require v4l2_dev, rename parent to dev_parent
      Signed-off-by: default avatarArun Kumar K <arun.kk@samsung.com>
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d9d780f
    • Vasily Titskiy's avatar
      HID: usbhid: quirk for N-Trig DuoSense Touch Screen · 5f24e184
      Vasily Titskiy authored
      commit 9e0bf92c upstream.
      
      The DuoSense touchscreen device causes a 10 second timeout. This fix
      removes the delay.
      Signed-off-by: default avatarVasily Titskiy <qehgt0@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f24e184
    • Kees Cook's avatar
      HID: check for NULL field when setting values · 8bb7aace
      Kees Cook authored
      commit be67b68d upstream.
      
      Defensively check that the field to be worked on is not NULL.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8bb7aace
    • Manoj Chourasia's avatar
      HID: hidraw: correctly deallocate memory on device disconnect · d0de24dd
      Manoj Chourasia authored
      commit 212a871a upstream.
      
      This changes puts the commit 4fe9f8e2 back in place
      with the fixes for slab corruption because of the commit.
      
      When a device is unplugged, wait for all processes that
      have opened the device to close before deallocating the device.
      
      This commit was solving kernel crash because of the corruption in
      rb tree of vmalloc. The rootcause was the device data pointer was
      geting excessed after the memory associated with hidraw was freed.
      
      The commit 4fe9f8e2 was buggy as it was also freeing the hidraw
      first and then calling delete operation on the list associated with
      that hidraw leading to slab corruption.
      Signed-off-by: default avatarManoj Chourasia <mchourasia@nvidia.com>
      Tested-by: default avatarPeter Wu <lekensteyn@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0de24dd
    • Jiri Kosina's avatar
      HID: battery: don't do DMA from stack · 65a839f4
      Jiri Kosina authored
      commit 6c2794a2 upstream.
      
      Instead of using data from stack for DMA in hidinput_get_battery_property(),
      allocate the buffer dynamically.
      Reported-by: default avatarRichard Ryniker <ryniker@alum.mit.edu>
      Reported-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65a839f4
    • Bruno Prémont's avatar
      HID: picolcd: Prevent NULL pointer dereference on _remove() · 69f2af2d
      Bruno Prémont authored
      commit 1cde501b upstream.
      
      When picolcd is switched into bootloader mode (for FW flashing) make
      sure not to try to dereference NULL-pointers of feature-devices during
      unplug/unbind.
      
      This fixes following BUG:
        BUG: unable to handle kernel NULL pointer dereference at 00000298
        IP: [<f811f56b>] picolcd_exit_framebuffer+0x1b/0x80 [hid_picolcd]
        *pde = 00000000
        Oops: 0000 [#1]
        Modules linked in: hid_picolcd syscopyarea sysfillrect sysimgblt fb_sys_fops
        CPU: 0 PID: 15 Comm: khubd Not tainted 3.11.0-rc7-00002-g50d62d4 #2
        EIP: 0060:[<f811f56b>] EFLAGS: 00010292 CPU: 0
        EIP is at picolcd_exit_framebuffer+0x1b/0x80 [hid_picolcd]
        Call Trace:
         [<f811d1ab>] picolcd_remove+0xcb/0x120 [hid_picolcd]
         [<c1469b09>] hid_device_remove+0x59/0xc0
         [<c13464ca>] __device_release_driver+0x5a/0xb0
         [<c134653f>] device_release_driver+0x1f/0x30
         [<c134603d>] bus_remove_device+0x9d/0xd0
         [<c13439a5>] device_del+0xd5/0x150
         [<c14696a4>] hid_destroy_device+0x24/0x60
         [<c1474cbb>] usbhid_disconnect+0x1b/0x40
         ...
      Signed-off-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69f2af2d
    • Kees Cook's avatar
      HID: ntrig: validate feature report details · 7c91362f
      Kees Cook authored
      commit 875b4e37 upstream.
      
      A HID device could send a malicious feature report that would cause the
      ntrig HID driver to trigger a NULL dereference during initialization:
      
      [57383.031190] usb 3-1: New USB device found, idVendor=1b96, idProduct=0001
      ...
      [57383.315193] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
      [57383.315308] IP: [<ffffffffa08102de>] ntrig_probe+0x25e/0x420 [hid_ntrig]
      
      CVE-2013-2896
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarRafi Rubin <rafi@seas.upenn.edu>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c91362f
    • Kees Cook's avatar
      HID: picolcd_core: validate output report details · 0697d805
      Kees Cook authored
      commit 1e87a245 upstream.
      
      A HID device could send a malicious output report that would cause the
      picolcd HID driver to trigger a NULL dereference during attr file writing.
      
      [jkosina@suse.cz: changed
      
      	report->maxfield < 1
      
      to
      
      	report->maxfield != 1
      
      as suggested by Bruno].
      
      CVE-2013-2899
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Acked-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0697d805
    • Kees Cook's avatar
      HID: validate HID report id size · 56085cec
      Kees Cook authored
      commit 43622021 upstream.
      
      The "Report ID" field of a HID report is used to build indexes of
      reports. The kernel's index of these is limited to 256 entries, so any
      malicious device that sets a Report ID greater than 255 will trigger
      memory corruption on the host:
      
      [ 1347.156239] BUG: unable to handle kernel paging request at ffff88094958a878
      [ 1347.156261] IP: [<ffffffff813e4da0>] hid_register_report+0x2a/0x8b
      
      CVE-2013-2888
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56085cec
    • Kees Cook's avatar
      HID: sensor-hub: validate feature report details · a3957df7
      Kees Cook authored
      commit 9e891025 upstream.
      
      A HID device could send a malicious feature report that would cause the
      sensor-hub HID driver to read past the end of heap allocation, leaking
      kernel memory contents to the caller.
      
      CVE-2013-2898
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3957df7
    • Stefan Kriwanek's avatar
      HID: Fix Speedlink VAD Cezanne support for some devices · 469e7f80
      Stefan Kriwanek authored
      commit 06bb5219 upstream.
      
      Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing
      than already done.
      
      I made sure through testing that this patch would not interfere with the proper
      working of a device that is bug-free. (The driver drops EV_REL events with
      abs(val) >= 256, which are not achievable even on the highest laser resolution
      hardware setting.)
      Signed-off-by: default avatarStefan Kriwanek <mail@stefankriwanek.de>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      469e7f80
    • Kees Cook's avatar
      HID: pantherlord: validate output report details · 769eea24
      Kees Cook authored
      commit 412f3010 upstream.
      
      A HID device could send a malicious output report that would cause the
      pantherlord HID driver to write beyond the output report allocation
      during initialization, causing a heap overflow:
      
      [  310.939483] usb 1-1: New USB device found, idVendor=0e8f, idProduct=0003
      ...
      [  315.980774] BUG kmalloc-192 (Tainted: G        W   ): Redzone overwritten
      
      CVE-2013-2892
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      769eea24
    • Henrik Rydberg's avatar
      HID: Correct the USB IDs for the new Macbook Air 6 · 32a190b7
      Henrik Rydberg authored
      commit 8c89cc17 upstream.
      
      A recent patch (9d9a04ee) added support for the new machine, but got
      the sequence of USB ids wrong. Reports from both Ian and Linus T show
      that the 0x0291 id is for ISO, not ANSI, which should have the missing
      number 0x0290. This patchs moves the three numbers accordingly, fixing
      the problem.
      Reported-and-tested-by: default avatarIan Munsie <darkstarsword@gmail.com>
      Tested-by: default avatarLinus G Thiel <linus@hanssonlarsson.se>
      Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
      Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32a190b7
    • Felix Fietkau's avatar
      ath9k: avoid accessing MRC registers on single-chain devices · 4bd13a76
      Felix Fietkau authored
      commit a1c781bb upstream.
      
      They are not implemented, and accessing them might trigger errors
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4bd13a76
    • Felix Fietkau's avatar
      ath9k: fix rx descriptor related race condition · 8e4d4c93
      Felix Fietkau authored
      commit e96542e5 upstream.
      
      Similar to a race condition that exists in the tx path, the hardware
      might re-read the 'next' pointer of a descriptor of the last completed
      frame. This only affects non-EDMA (pre-AR93xx) devices.
      
      To deal with this race, defer clearing and re-linking a completed rx
      descriptor until the next one has been processed.
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e4d4c93
    • Felix Fietkau's avatar
      ath9k: always clear ps filter bit on new assoc · 31f34c79
      Felix Fietkau authored
      commit 026d5b07 upstream.
      
      Otherwise in some cases, EAPOL frames might be filtered during the
      initial handshake, causing delays and assoc failures.
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31f34c79
    • John W. Linville's avatar
      brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error() · d31a13c7
      John W. Linville authored
      commit 67d0cf50 upstream.
      
      The driver fails to check the results of DMA mapping in twp places,
      which results in the following warning:
      
      [   28.078515] ------------[ cut here ]------------
      [   28.078529] WARNING: at lib/dma-debug.c:937 check_unmap+0x47e/0x930()
      [   28.078533] bcma-pci-bridge 0000:0e:00.0: DMA-API: device driver failed to check map error[device address=0x00000000b5d60d6c] [size=1876 bytes] [mapped as
       single]
      [   28.078536] Modules linked in: bnep bluetooth vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) ipv6 b43 brcmsmac rtl8192cu rtl8192c_common rtlwifi mac802
      11 brcmutil cfg80211 snd_hda_codec_conexant rng_core snd_hda_intel kvm_amd snd_hda_codec ssb kvm mmc_core snd_pcm snd_seq snd_timer snd_seq_device snd k8temp
       cordic joydev serio_raw hwmon sr_mod sg pcmcia pcmcia_core soundcore cdrom i2c_nforce2 i2c_core forcedeth bcma snd_page_alloc autofs4 ext4 jbd2 mbcache crc1
      6 scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic pata_amd
      [   28.078602] CPU: 1 PID: 2570 Comm: NetworkManager Tainted: G           O 3.10.0-rc7-wl+ #42
      [   28.078605] Hardware name: Hewlett-Packard HP Pavilion dv2700 Notebook PC/30D6, BIOS F.27 11/27/2008
      [   28.078607]  0000000000000009 ffff8800bbb03ad8 ffffffff8144f898 ffff8800bbb03b18
      [   28.078612]  ffffffff8103e1eb 0000000000000002 ffff8800b719f480 ffff8800b7b9c010
      [   28.078617]  ffffffff824204c0 ffffffff81754d57 0000000000000754 ffff8800bbb03b78
      [   28.078622] Call Trace:
      [   28.078624]  <IRQ>  [<ffffffff8144f898>] dump_stack+0x19/0x1b
      [   28.078634]  [<ffffffff8103e1eb>] warn_slowpath_common+0x6b/0xa0
      [   28.078638]  [<ffffffff8103e2c1>] warn_slowpath_fmt+0x41/0x50
      [   28.078650]  [<ffffffff8122d7ae>] check_unmap+0x47e/0x930
      [   28.078655]  [<ffffffff8122de4c>] debug_dma_unmap_page+0x5c/0x70
      [   28.078679]  [<ffffffffa04a808c>] dma64_getnextrxp+0x10c/0x190 [brcmsmac]
      [   28.078691]  [<ffffffffa04a9042>] dma_rx+0x62/0x240 [brcmsmac]
      [   28.078707]  [<ffffffffa0479101>] brcms_c_dpc+0x211/0x9d0 [brcmsmac]
      [   28.078717]  [<ffffffffa046d927>] ? brcms_dpc+0x27/0xf0 [brcmsmac]
      [   28.078731]  [<ffffffffa046d947>] brcms_dpc+0x47/0xf0 [brcmsmac]
      [   28.078736]  [<ffffffff81047dcc>] tasklet_action+0x6c/0xf0
      --snip--
      [   28.078974]  [<ffffffff813891bd>] SyS_sendmsg+0xd/0x20
      [   28.078979]  [<ffffffff81455c24>] tracesys+0xdd/0xe2
      [   28.078982] ---[ end trace 6164d1a08148e9c8 ]---
      [   28.078984] Mapped at:
      [   28.078985]  [<ffffffff8122c8fd>] debug_dma_map_page+0x9d/0x150
      [   28.078989]  [<ffffffffa04a9322>] dma_rxfill+0x102/0x3d0 [brcmsmac]
      [   28.079001]  [<ffffffffa047a13d>] brcms_c_init+0x87d/0x1100 [brcmsmac]
      [   28.079010]  [<ffffffffa046d851>] brcms_init+0x21/0x30 [brcmsmac]
      [   28.079018]  [<ffffffffa04786e0>] brcms_c_up+0x150/0x430 [brcmsmac]
      
      As the patch adds a new failure mechanism to dma_rxfill(). When I changed the
      comment at the start of the routine to add that information, I also polished
      the wording.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Brett Rudley <brudley@broadcom.com>
      Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
      Cc: Hante Meuleman <meuleman@broadcom.com>
      Cc: brcm80211-dev-list@broadcom.com
      Acked-by: default avatarArend van Spriel <arend@broadcom.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d31a13c7
    • Jan Kara's avatar
      ext4: simplify truncation code in ext4_setattr() · 263c784f
      Jan Kara authored
      commit 5208386c upstream.
      
      Merge conditions in ext4_setattr() handling inode size changes, also
      move ext4_begin_ordered_truncate() call somewhat earlier because it
      simplifies error recovery in case of failure. Also add error handling in
      case i_disksize update fails.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      263c784f
    • Boris BREZILLON's avatar
      pinctrl: at91: fix get_pullup/down function return · 25a870d4
      Boris BREZILLON authored
      commit 05d3534a upstream.
      
      In PIO_PUSR and PIO_PPDSR register if a given bit is set 1 this means the
      pullup/down for this pin (pin is represented as a bit position) is
      disabled.
      Signed-off-by: default avatarBoris BREZILLON <b.brezillon@overkiz.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25a870d4
    • Takashi Iwai's avatar
      ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist · ff70cfaf
      Takashi Iwai authored
      commit 83f72151 upstream.
      
      Toshiba Satellite C870 shows interrupt problems occasionally when
      certain mixer controls like "Mic Switch" is toggled.  This seems
      worked around by not using MSI.
      
      Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=833585Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff70cfaf
    • Anssi Hannula's avatar
      ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA · 686edbc0
      Anssi Hannula authored
      commit 18e39186 upstream.
      
      hdmi_channel_allocation() tries to find a HDMI channel allocation that
      matches the number channels in the playback stream and contains only
      speakers that the HDMI sink has reported as available via EDID. If no
      such allocation is found, 0 (stereo audio) is used.
      
      Using CA 0 causes the audio causes the sink to discard everything except
      the first two channels (front left and front right).
      
      However, the sink may be capable of receiving more channels than it has
      speakers (and then perform downmix or discard the extra channels), in
      which case it is preferable to use a CA that contains extra channels
      than to use CA 0 which discards all the non-stereo channels.
      
      Additionally, it seems that HBR (HD) passthrough output does not work on
      Intel HDMI codecs when CA is set to 0 (possibly the codec zeroes
      channels not present in CA). This happens with all receivers that report
      a 5.1 speaker mask since a HBR stream is carried on 8 channels to the
      codec.
      
      Add a fallback in the CA selection so that the CA channel count at least
      matches the stream channel count, even if the stream contains channels
      not present in the sink speaker descriptor.
      
      Thanks to GrimGriefer at OpenELEC forums for discovering that changing
      the sink speaker mask allowed HBR output.
      
      Reported-by: GrimGriefer
      Reported-by: Ashecrow
      Reported-by: default avatarFrank Zafka <kafkaesque1978@gmail.com>
      Reported-by: default avatarPeter Frühberger <fritsch@xbmc.org>
      Signed-off-by: default avatarAnssi Hannula <anssi.hannula@iki.fi>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      686edbc0