1. 02 Aug, 2013 9 commits
  2. 27 Jul, 2013 31 commits
    • Ben Hutchings's avatar
      Linux 3.2.49 · 66421b21
      Ben Hutchings authored
      66421b21
    • Greg Kroah-Hartman's avatar
      MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information · 9ba4c399
      Greg Kroah-Hartman authored
      commit 7b175c46 upstream.
      
      This hopefully will help point developers to the proper way that patches
      should be submitted for inclusion in the stable kernel releases.
      Reported-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9ba4c399
    • Greg KH's avatar
      MAINTAINERS: Greg's suse email address is dead · 558fa9bb
      Greg KH authored
      commit 879a5a00 upstream.
      
      My email address has changed, the suse.de one is now dead, so update all
      of my MAINTAINER entries with the correct one so that patches don't get
      lost.
      
      Also change the status of some of my entries as I'm supposed to be doing
      this stuff now for real.
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      558fa9bb
    • Jan Kara's avatar
      ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs · 5b1b5af5
      Jan Kara authored
      commit a60697f4 upstream.
      
      On 32-bit architectures with 32-bit sector_t computation of data offset
      in ext4_xattr_fiemap() can overflow resulting in reporting bogus data
      location. Fix the problem by typing block number to proper type before
      shifting.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5b1b5af5
    • Jan Kara's avatar
      ext4: fix overflow when counting used blocks on 32-bit architectures · 967c9a98
      Jan Kara authored
      commit 8af8eecc upstream.
      
      The arithmetics adding delalloc blocks to the number of used blocks in
      ext4_getattr() can easily overflow on 32-bit archs as we first multiply
      number of blocks by blocksize and then divide back by 512. Make the
      arithmetics more clever and also use proper type (unsigned long long
      instead of unsigned long).
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      967c9a98
    • Jonathan Salwan's avatar
      drivers/cdrom/cdrom.c: use kzalloc() for failing hardware · 6dfd19d0
      Jonathan Salwan authored
      commit 542db015 upstream.
      
      In drivers/cdrom/cdrom.c mmc_ioctl_cdrom_read_data() allocates a memory
      area with kmalloc in line 2885.
      
        2885         cgc->buffer = kmalloc(blocksize, GFP_KERNEL);
        2886         if (cgc->buffer == NULL)
        2887                 return -ENOMEM;
      
      In line 2908 we can find the copy_to_user function:
      
        2908         if (!ret && copy_to_user(arg, cgc->buffer, blocksize))
      
      The cgc->buffer is never cleaned and initialized before this function.
      If ret = 0 with the previous basic block, it's possible to display some
      memory bytes in kernel space from userspace.
      
      When we read a block from the disk it normally fills the ->buffer but if
      the drive is malfunctioning there is a chance that it would only be
      partially filled.  The result is an leak information to userspace.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6dfd19d0
    • Liang Li's avatar
      pch_uart: fix a deadlock when pch_uart as console · 790e332c
      Liang Li authored
      commit 384e301e upstream.
      
      When we use pch_uart as system console like 'console=ttyPCH0,115200',
      then 'send break' to it. We'll encounter the deadlock on a cpu/core,
      with interrupts disabled on the core. When we happen to have all irqs
      affinity to cpu0 then the deadlock on cpu0 actually deadlock whole
      system.
      
      In pch_uart_interrupt, we have spin_lock_irqsave(&priv->lock, flags)
      then call pch_uart_err_ir when break is received. Then the call to
      dev_err would actually call to pch_console_write then we'll run into
      another spin_lock(&priv->lock), with interrupts disabled.
      
      So in the call sequence lead by pch_uart_interrupt, we should be
      carefully to call functions that will 'print message to console' only
      in case the uart port is not being used as serial console.
      Signed-off-by: default avatarLiang Li <liang.li@windriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      790e332c
    • Peter Zijlstra's avatar
      perf: Fix mmap() accounting hole · 2487f0db
      Peter Zijlstra authored
      commit 9bb5d40c upstream.
      
      Vince's fuzzer once again found holes. This time it spotted a leak in
      the locked page accounting.
      
      When an event had redirected output and its close() was the last
      reference to the buffer we didn't have a vm context to undo accounting.
      
      Change the code to destroy the buffer on the last munmap() and detach
      all redirected events at that time. This provides us the right context
      to undo the vm accounting.
      
      [Backporting for 3.4-stable.
      VM_RESERVED flag was replaced with pair 'VM_DONTEXPAND | VM_DONTDUMP' in
      314e51b9 since 3.7.0-rc1, and 314e51b9 comes from a big patchset, we didn't
      backport the patchset, so I restored 'VM_DNOTEXPAND | VM_DONTDUMP' as before:
      -	vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP;
      +	vma->vm_flags |= VM_DONTCOPY | VM_RESERVED;
       -- zliu]
      Reported-and-tested-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20130604084421.GI8923@twins.programming.kicks-ass.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: drop unrelated addition of braces in free_event()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2487f0db
    • Peter Zijlstra's avatar
      perf: Fix perf mmap bugs · 7edcd181
      Peter Zijlstra authored
      commit 26cb63ad upstream.
      
      Vince reported a problem found by his perf specific trinity
      fuzzer.
      
      Al noticed 2 problems with perf's mmap():
      
       - it has issues against fork() since we use vma->vm_mm for accounting.
       - it has an rb refcount leak on double mmap().
      
      We fix the issues against fork() by using VM_DONTCOPY; I don't
      think there's code out there that uses this; we didn't hear
      about weird accounting problems/crashes. If we do need this to
      work, the previously proposed VM_PINNED could make this work.
      
      Aside from the rb reference leak spotted by Al, Vince's example
      prog was indeed doing a double mmap() through the use of
      perf_event_set_output().
      
      This exposes another problem, since we now have 2 events with
      one buffer, the accounting gets screwy because we account per
      event. Fix this by making the buffer responsible for its own
      accounting.
      
      [Backporting for 3.4-stable.
      VM_RESERVED flag was replaced with pair 'VM_DONTEXPAND | VM_DONTDUMP' in
      314e51b9 since 3.7.0-rc1, and 314e51b9 comes from a big patchset, we didn't
      backport the patchset, so I restored 'VM_DNOTEXPAND | VM_DONTDUMP' as before:
      -       vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP;
      +       vma->vm_flags |= VM_DONTCOPY | VM_RESERVED;
       -- zliu]
      Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Link: http://lkml.kernel.org/r/20130528085548.GA12193@twins.programming.kicks-ass.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7edcd181
    • Sage Weil's avatar
      ceph: fix statvfs fr_size · ae804ee7
      Sage Weil authored
      commit 92a49fb0 upstream.
      
      Different versions of glibc are broken in different ways, but the short of
      it is that for the time being, frsize should == bsize, and be used as the
      multiple for the blocks, free, and available fields.  This mirrors what is
      done for NFS.  The previous reporting of the page size for frsize meant
      that newer glibc and df would report a very small value for the fs size.
      
      Fixes http://tracker.ceph.com/issues/3793.
      Signed-off-by: default avatarSage Weil <sage@inktank.com>
      Reviewed-by: default avatarGreg Farnum <greg@inktank.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ae804ee7
    • Peter Zijlstra's avatar
      perf: Fix perf_lock_task_context() vs RCU · a7aa204d
      Peter Zijlstra authored
      commit 058ebd0e upstream.
      
      Jiri managed to trigger this warning:
      
       [] ======================================================
       [] [ INFO: possible circular locking dependency detected ]
       [] 3.10.0+ #228 Tainted: G        W
       [] -------------------------------------------------------
       [] p/6613 is trying to acquire lock:
       []  (rcu_node_0){..-...}, at: [<ffffffff810ca797>] rcu_read_unlock_special+0xa7/0x250
       []
       [] but task is already holding lock:
       []  (&ctx->lock){-.-...}, at: [<ffffffff810f2879>] perf_lock_task_context+0xd9/0x2c0
       []
       [] which lock already depends on the new lock.
       []
       [] the existing dependency chain (in reverse order) is:
       []
       [] -> #4 (&ctx->lock){-.-...}:
       [] -> #3 (&rq->lock){-.-.-.}:
       [] -> #2 (&p->pi_lock){-.-.-.}:
       [] -> #1 (&rnp->nocb_gp_wq[1]){......}:
       [] -> #0 (rcu_node_0){..-...}:
      
      Paul was quick to explain that due to preemptible RCU we cannot call
      rcu_read_unlock() while holding scheduler (or nested) locks when part
      of the read side critical section was preemptible.
      
      Therefore solve it by making the entire RCU read side non-preemptible.
      
      Also pull out the retry from under the non-preempt to play nice with RT.
      Reported-by: default avatarJiri Olsa <jolsa@redhat.com>
      Helped-out-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a7aa204d
    • Jiri Olsa's avatar
      perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario · b76c8d11
      Jiri Olsa authored
      commit 06f41796 upstream.
      
      The '!ctx->is_active' check has a valid scenario, so
      there's no need for the warning.
      
      The reason is that there's a time window between the
      'ctx->is_active' check in the perf_event_enable() function
      and the __perf_event_enable() function having:
      
        - IRQs on
        - ctx->lock unlocked
      
      where the task could be killed and 'ctx' deactivated by
      perf_event_exit_task(), ending up with the warning below.
      
      So remove the WARN_ON_ONCE() check and add comments to
      explain it all.
      
      This addresses the following warning reported by Vince Weaver:
      
      [  324.983534] ------------[ cut here ]------------
      [  324.984420] WARNING: at kernel/events/core.c:1953 __perf_event_enable+0x187/0x190()
      [  324.984420] Modules linked in:
      [  324.984420] CPU: 19 PID: 2715 Comm: nmi_bug_snb Not tainted 3.10.0+ #246
      [  324.984420] Hardware name: Supermicro X8DTN/X8DTN, BIOS 4.6.3 01/08/2010
      [  324.984420]  0000000000000009 ffff88043fce3ec8 ffffffff8160ea0b ffff88043fce3f00
      [  324.984420]  ffffffff81080ff0 ffff8802314fdc00 ffff880231a8f800 ffff88043fcf7860
      [  324.984420]  0000000000000286 ffff880231a8f800 ffff88043fce3f10 ffffffff8108103a
      [  324.984420] Call Trace:
      [  324.984420]  <IRQ>  [<ffffffff8160ea0b>] dump_stack+0x19/0x1b
      [  324.984420]  [<ffffffff81080ff0>] warn_slowpath_common+0x70/0xa0
      [  324.984420]  [<ffffffff8108103a>] warn_slowpath_null+0x1a/0x20
      [  324.984420]  [<ffffffff81134437>] __perf_event_enable+0x187/0x190
      [  324.984420]  [<ffffffff81130030>] remote_function+0x40/0x50
      [  324.984420]  [<ffffffff810e51de>] generic_smp_call_function_single_interrupt+0xbe/0x130
      [  324.984420]  [<ffffffff81066a47>] smp_call_function_single_interrupt+0x27/0x40
      [  324.984420]  [<ffffffff8161fd2f>] call_function_single_interrupt+0x6f/0x80
      [  324.984420]  <EOI>  [<ffffffff816161a1>] ? _raw_spin_unlock_irqrestore+0x41/0x70
      [  324.984420]  [<ffffffff8113799d>] perf_event_exit_task+0x14d/0x210
      [  324.984420]  [<ffffffff810acd04>] ? switch_task_namespaces+0x24/0x60
      [  324.984420]  [<ffffffff81086946>] do_exit+0x2b6/0xa40
      [  324.984420]  [<ffffffff8161615c>] ? _raw_spin_unlock_irq+0x2c/0x30
      [  324.984420]  [<ffffffff81087279>] do_group_exit+0x49/0xc0
      [  324.984420]  [<ffffffff81096854>] get_signal_to_deliver+0x254/0x620
      [  324.984420]  [<ffffffff81043057>] do_signal+0x57/0x5a0
      [  324.984420]  [<ffffffff8161a164>] ? __do_page_fault+0x2a4/0x4e0
      [  324.984420]  [<ffffffff8161665c>] ? retint_restore_args+0xe/0xe
      [  324.984420]  [<ffffffff816166cd>] ? retint_signal+0x11/0x84
      [  324.984420]  [<ffffffff81043605>] do_notify_resume+0x65/0x80
      [  324.984420]  [<ffffffff81616702>] retint_signal+0x46/0x84
      [  324.984420] ---[ end trace 442ec2f04db3771a ]---
      Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Suggested-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1373384651-6109-2-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b76c8d11
    • Jiri Olsa's avatar
      perf: Clone child context from parent context pmu · 2a53ead9
      Jiri Olsa authored
      commit 734df5ab upstream.
      
      Currently when the child context for inherited events is
      created, it's based on the pmu object of the first event
      of the parent context.
      
      This is wrong for the following scenario:
      
        - HW context having HW and SW event
        - HW event got removed (closed)
        - SW event stays in HW context as the only event
          and its pmu is used to clone the child context
      
      The issue starts when the cpu context object is touched
      based on the pmu context object (__get_cpu_context). In
      this case the HW context will work with SW cpu context
      ending up with following WARN below.
      
      Fixing this by using parent context pmu object to clone
      from child context.
      
      Addresses the following warning reported by Vince Weaver:
      
      [ 2716.472065] ------------[ cut here ]------------
      [ 2716.476035] WARNING: at kernel/events/core.c:2122 task_ctx_sched_out+0x3c/0x)
      [ 2716.476035] Modules linked in: nfsd auth_rpcgss oid_registry nfs_acl nfs locn
      [ 2716.476035] CPU: 0 PID: 3164 Comm: perf_fuzzer Not tainted 3.10.0-rc4 #2
      [ 2716.476035] Hardware name: AOpen   DE7000/nMCP7ALPx-DE R1.06 Oct.19.2012, BI2
      [ 2716.476035]  0000000000000000 ffffffff8102e215 0000000000000000 ffff88011fc18
      [ 2716.476035]  ffff8801175557f0 0000000000000000 ffff880119fda88c ffffffff810ad
      [ 2716.476035]  ffff880119fda880 ffffffff810af02a 0000000000000009 ffff880117550
      [ 2716.476035] Call Trace:
      [ 2716.476035]  [<ffffffff8102e215>] ? warn_slowpath_common+0x5b/0x70
      [ 2716.476035]  [<ffffffff810ab2bd>] ? task_ctx_sched_out+0x3c/0x5f
      [ 2716.476035]  [<ffffffff810af02a>] ? perf_event_exit_task+0xbf/0x194
      [ 2716.476035]  [<ffffffff81032a37>] ? do_exit+0x3e7/0x90c
      [ 2716.476035]  [<ffffffff810cd5ab>] ? __do_fault+0x359/0x394
      [ 2716.476035]  [<ffffffff81032fe6>] ? do_group_exit+0x66/0x98
      [ 2716.476035]  [<ffffffff8103dbcd>] ? get_signal_to_deliver+0x479/0x4ad
      [ 2716.476035]  [<ffffffff810ac05c>] ? __perf_event_task_sched_out+0x230/0x2d1
      [ 2716.476035]  [<ffffffff8100205d>] ? do_signal+0x3c/0x432
      [ 2716.476035]  [<ffffffff810abbf9>] ? ctx_sched_in+0x43/0x141
      [ 2716.476035]  [<ffffffff810ac2ca>] ? perf_event_context_sched_in+0x7a/0x90
      [ 2716.476035]  [<ffffffff810ac311>] ? __perf_event_task_sched_in+0x31/0x118
      [ 2716.476035]  [<ffffffff81050dd9>] ? mmdrop+0xd/0x1c
      [ 2716.476035]  [<ffffffff81051a39>] ? finish_task_switch+0x7d/0xa6
      [ 2716.476035]  [<ffffffff81002473>] ? do_notify_resume+0x20/0x5d
      [ 2716.476035]  [<ffffffff813654f5>] ? retint_signal+0x3d/0x78
      [ 2716.476035] ---[ end trace 827178d8a5966c3d ]---
      Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1373384651-6109-1-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2a53ead9
    • Jörn Engel's avatar
      iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow · 0c6830bb
      Jörn Engel authored
      commit 0fbfc46f upstream.
      
      This patch fixes a potential buffer overflow while processing
      iscsi_node_auth input for configfs attributes within NodeACL
      tfc_tpg_nacl_auth_cit context.
      Signed-off-by: default avatarJoern Engel <joern@logfs.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0c6830bb
    • Bjørn Mork's avatar
      megaraid_sas: fix memory leak if SGL has zero length entries · 0465278f
      Bjørn Mork authored
      commit 7a6a731b upstream.
      
      commit 98cb7e44 ([SCSI] megaraid_sas: Sanity check user
      supplied length before passing it to dma_alloc_coherent())
      introduced a memory leak.  Memory allocated for entries
      following zero length SGL entries will not be freed.
      
      Reference: http://bugs.debian.org/688198Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Acked-by: default avatarAdam Radford <aradford@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0465278f
    • Mikulas Patocka's avatar
      hpfs: better test for errors · e74ac4ba
      Mikulas Patocka authored
      commit 3ebacb05 upstream.
      
      The test if bitmap access is out of bound could errorneously pass if the
      device size is divisible by 16384 sectors and we are asking for one bitmap
      after the end.
      
      Check for invalid size in the superblock. Invalid size could cause integer
      overflows in the rest of the code.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@artax.karlin.mff.cuni.cz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e74ac4ba
    • Paul Clements's avatar
      nbd: correct disconnect behavior · b5f8e987
      Paul Clements authored
      commit c378f70a upstream.
      
      Currently, when a disconnect is requested by the user (via NBD_DISCONNECT
      ioctl) the return from NBD_DO_IT is undefined (it is usually one of
      several error codes).  This means that nbd-client does not know if a
      manual disconnect was performed or whether a network error occurred.
      Because of this, nbd-client's persist mode (which tries to reconnect after
      error, but not after manual disconnect) does not always work correctly.
      
      This change fixes this by causing NBD_DO_IT to always return 0 if a user
      requests a disconnect.  This means that nbd-client can correctly either
      persist the connection (if an error occurred) or disconnect (if the user
      requested it).
      Signed-off-by: default avatarPaul Clements <paul.clements@steeleye.com>
      Acked-by: default avatarRob Landley <rob@landley.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust device pointer name]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b5f8e987
    • Axel Lin's avatar
      drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq · c8b425eb
      Axel Lin authored
      commit 29ecd78c upstream.
      
      In the disable AIE irq code path, current code passes "1" to enable
      parameter of rv3029c2_rtc_i2c_alarm_set_irq().  Thus it does not disable
      AIE irq.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Acked-by: default avatarHeiko Schocher <hs@denx.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c8b425eb
    • Kees Cook's avatar
      crypto: sanitize argument for format string · 00bbe5df
      Kees Cook authored
      commit 1c8fca1d upstream.
      
      The template lookup interface does not provide a way to use format
      strings, so make sure that the interface cannot be abused accidentally.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      00bbe5df
    • Kees Cook's avatar
      block: do not pass disk names as format strings · b4422230
      Kees Cook authored
      commit ffc8b308 upstream.
      
      Disk names may contain arbitrary strings, so they must not be
      interpreted as format strings.  It seems that only md allows arbitrary
      strings to be used for disk names, but this could allow for a local
      memory corruption from uid 0 into ring 0.
      
      CVE-2013-2851
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust device pointer name in nbd.c]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b4422230
    • Junxiao Bi's avatar
      ocfs2: xattr: fix inlined xattr reflink · 93f26306
      Junxiao Bi authored
      commit ef962df0 upstream.
      
      Inlined xattr shared free space of inode block with inlined data or data
      extent record, so the size of the later two should be adjusted when
      inlined xattr is enabled.  See ocfs2_xattr_ibody_init().  But this isn't
      done well when reflink.  For inode with inlined data, its max inlined
      data size is adjusted in ocfs2_duplicate_inline_data(), no problem.  But
      for inode with data extent record, its record count isn't adjusted.  Fix
      it, or data extent record and inlined xattr may overwrite each other,
      then cause data corruption or xattr failure.
      
      One panic caused by this bug in our test environment is the following:
      
        kernel BUG at fs/ocfs2/xattr.c:1435!
        invalid opcode: 0000 [#1] SMP
        Pid: 10871, comm: multi_reflink_t Not tainted 2.6.39-300.17.1.el5uek #1
        RIP: ocfs2_xa_offset_pointer+0x17/0x20 [ocfs2]
        RSP: e02b:ffff88007a587948  EFLAGS: 00010283
        RAX: 0000000000000000 RBX: 0000000000000010 RCX: 00000000000051e4
        RDX: ffff880057092060 RSI: 0000000000000f80 RDI: ffff88007a587a68
        RBP: ffff88007a587948 R08: 00000000000062f4 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000010
        R13: ffff88007a587a68 R14: 0000000000000001 R15: ffff88007a587c68
        FS:  00007fccff7f06e0(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
        CS:  e033 DS: 0000 ES: 0000 CR0: 000000008005003b
        CR2: 00000000015cf000 CR3: 000000007aa76000 CR4: 0000000000000660
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
        Process multi_reflink_t
        Call Trace:
          ocfs2_xa_reuse_entry+0x60/0x280 [ocfs2]
          ocfs2_xa_prepare_entry+0x17e/0x2a0 [ocfs2]
          ocfs2_xa_set+0xcc/0x250 [ocfs2]
          ocfs2_xattr_ibody_set+0x98/0x230 [ocfs2]
          __ocfs2_xattr_set_handle+0x4f/0x700 [ocfs2]
          ocfs2_xattr_set+0x6c6/0x890 [ocfs2]
          ocfs2_xattr_user_set+0x46/0x50 [ocfs2]
          generic_setxattr+0x70/0x90
          __vfs_setxattr_noperm+0x80/0x1a0
          vfs_setxattr+0xa9/0xb0
          setxattr+0xc3/0x120
          sys_fsetxattr+0xa8/0xd0
          system_call_fastpath+0x16/0x1b
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarJie Liu <jeff.liu@oracle.com>
      Acked-by: default avatarJoel Becker <jlbec@evilplan.org>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Sunil Mushran <sunil.mushran@gmail.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 avatarBen Hutchings <ben@decadent.org.uk>
      93f26306
    • Bartlomiej Zolnierkiewicz's avatar
      drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() · 3dfd7540
      Bartlomiej Zolnierkiewicz authored
      commit da331ba8 upstream.
      
      tasklet_kill() may sleep so call it before taking pch->lock.
      
      Fixes following lockup:
      
        BUG: scheduling while atomic: cat/2383/0x00000002
        Modules linked in:
          unwind_backtrace+0x0/0xfc
          __schedule_bug+0x4c/0x58
          __schedule+0x690/0x6e0
          sys_sched_yield+0x70/0x78
          tasklet_kill+0x34/0x8c
          pl330_free_chan_resources+0x24/0x88
          dma_chan_put+0x4c/0x50
        [...]
        BUG: spinlock lockup suspected on CPU#0, swapper/0/0
         lock: 0xe52aa04c, .magic: dead4ead, .owner: cat/2383, .owner_cpu: 1
          unwind_backtrace+0x0/0xfc
          do_raw_spin_lock+0x194/0x204
          _raw_spin_lock_irqsave+0x20/0x28
          pl330_tasklet+0x2c/0x5a8
          tasklet_action+0xfc/0x114
          __do_softirq+0xe4/0x19c
          irq_exit+0x98/0x9c
          handle_IPI+0x124/0x16c
          gic_handle_irq+0x64/0x68
          __irq_svc+0x40/0x70
          cpuidle_wrap_enter+0x4c/0xa0
          cpuidle_enter_state+0x18/0x68
          cpuidle_idle_call+0xac/0xe0
          cpu_idle+0xac/0xf0
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
      Cc: Vinod Koul <vinod.koul@linux.intel.com>
      Cc: Tomasz Figa <t.figa@samsung.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 avatarBen Hutchings <ben@decadent.org.uk>
      3dfd7540
    • Tyler Hicks's avatar
      libceph: Fix NULL pointer dereference in auth client code · 88a40557
      Tyler Hicks authored
      commit 2cb33cac upstream.
      
      A malicious monitor can craft an auth reply message that could cause a
      NULL function pointer dereference in the client's kernel.
      
      To prevent this, the auth_none protocol handler needs an empty
      ceph_auth_client_ops->build_request() function.
      
      CVE-2013-1059
      Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
      Reported-by: default avatarChanam Park <chanam.park@hkpco.kr>
      Reviewed-by: default avatarSeth Arnold <seth.arnold@canonical.com>
      Reviewed-by: default avatarSage Weil <sage@inktank.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      88a40557
    • zhangwei(Jovi)'s avatar
      tracing: Fix irqs-off tag display in syscall tracing · 226f3aac
      zhangwei(Jovi) authored
      commit 11034ae9 upstream.
      
      All syscall tracing irqs-off tags are wrong, the syscall enter entry doesn't
      disable irqs.
      
       [root@jovi tracing]#echo "syscalls:sys_enter_open" > set_event
       [root@jovi tracing]# cat trace
       # tracer: nop
       #
       # entries-in-buffer/entries-written: 13/13   #P:2
       #
       #                              _-----=> irqs-off
       #                             / _----=> need-resched
       #                            | / _---=> hardirq/softirq
       #                            || / _--=> preempt-depth
       #                            ||| /     delay
       #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
       #              | |       |   ||||       |         |
             irqbalance-513   [000] d... 56115.496766: sys_open(filename: 804e1a6, flags: 0, mode: 1b6)
             irqbalance-513   [000] d... 56115.497008: sys_open(filename: 804e1bb, flags: 0, mode: 1b6)
               sendmail-771   [000] d... 56115.827982: sys_open(filename: b770e6d1, flags: 0, mode: 1b6)
      
      The reason is syscall tracing doesn't record irq_flags into buffer.
      The proper display is:
      
       [root@jovi tracing]#echo "syscalls:sys_enter_open" > set_event
       [root@jovi tracing]# cat trace
       # tracer: nop
       #
       # entries-in-buffer/entries-written: 14/14   #P:2
       #
       #                              _-----=> irqs-off
       #                             / _----=> need-resched
       #                            | / _---=> hardirq/softirq
       #                            || / _--=> preempt-depth
       #                            ||| /     delay
       #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
       #              | |       |   ||||       |         |
             irqbalance-514   [001] ....    46.213921: sys_open(filename: 804e1a6, flags: 0, mode: 1b6)
             irqbalance-514   [001] ....    46.214160: sys_open(filename: 804e1bb, flags: 0, mode: 1b6)
                  <...>-920   [001] ....    47.307260: sys_open(filename: 4e82a0c5, flags: 80000, mode: 0)
      
      Link: http://lkml.kernel.org/r/1365564393-10972-3-git-send-email-jovi.zhangwei@huawei.comSigned-off-by: default avatarzhangwei(Jovi) <jovi.zhangwei@huawei.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      226f3aac
    • J. Bruce Fields's avatar
      nfsd4: fix decoding of compounds across page boundaries · f956347b
      J. Bruce Fields authored
      commit 24750082 upstream.
      
      A freebsd NFSv4.0 client was getting rare IO errors expanding a tarball.
      A network trace showed the server returning BAD_XDR on the final getattr
      of a getattr+write+getattr compound.  The final getattr started on a
      page boundary.
      
      I believe the Linux client ignores errors on the post-write getattr, and
      that that's why we haven't seen this before.
      Reported-by: default avatarRick Macklem <rmacklem@uoguelph.ca>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f956347b
    • Theodore Ts'o's avatar
      jbd2: fix theoretical race in jbd2__journal_restart · 29b25876
      Theodore Ts'o authored
      commit 39c04153 upstream.
      
      Once we decrement transaction->t_updates, if this is the last handle
      holding the transaction from closing, and once we release the
      t_handle_lock spinlock, it's possible for the transaction to commit
      and be released.  In practice with normal kernels, this probably won't
      happen, since the commit happens in a separate kernel thread and it's
      unlikely this could all happen within the space of a few CPU cycles.
      
      On the other hand, with a real-time kernel, this could potentially
      happen, so save the tid found in transaction->t_tid before we release
      t_handle_lock.  It would require an insane configuration, such as one
      where the jbd2 thread was set to a very high real-time priority,
      perhaps because a high priority real-time thread is trying to read or
      write to a file system.  But some people who use real-time kernels
      have been known to do insane things, including controlling
      laser-wielding industrial robots.  :-)
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      29b25876
    • Al Viro's avatar
      ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree() · 78d07e4a
      Al Viro authored
      commit 64cb9273 upstream.
      
      Both ext3 and ext4 htree_dirblock_to_tree() is just filling the
      in-core rbtree for use by call_filldir().  All updates of ->f_pos are
      done by the latter; bumping it here (on error) is obviously wrong - we
      might very well have it nowhere near the block we'd found an error in.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      78d07e4a
    • Chen Gang's avatar
      powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries · 1aa33199
      Chen Gang authored
      commit 8246aca7 upstream.
      
      the smp_release_cpus is a normal funciton and called in normal environments,
        but it calls the __initdata spinning_secondaries.
        need modify spinning_secondaries to match smp_release_cpus.
      
      the related warning:
        (the linker report boot_paca.33377, but it should be spinning_secondaries)
      
      -----------------------------------------------------------------------------
      
      WARNING: arch/powerpc/kernel/built-in.o(.text+0x23176): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
      The function .smp_release_cpus() references
      the variable __initdata boot_paca.33377.
      This is often because .smp_release_cpus lacks a __initdata
      annotation or the annotation of boot_paca.33377 is wrong.
      
      WARNING: arch/powerpc/kernel/built-in.o(.text+0x231fe): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
      The function .smp_release_cpus() references
      the variable __initdata boot_paca.33377.
      This is often because .smp_release_cpus lacks a __initdata
      annotation or the annotation of boot_paca.33377 is wrong.
      
      -----------------------------------------------------------------------------
      Signed-off-by: default avatarChen Gang <gang.chen@asianux.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1aa33199
    • Greg Kroah-Hartman's avatar
      Revert "serial: 8250_pci: add support for another kind of NetMos Technology... · 577048c5
      Greg Kroah-Hartman authored
      Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller"
      
      commit 828c6a10 upstream.
      
      This reverts commit 8d2f8cd4.
      
      As reported by Stefan, this device already works with the parport_serial
      driver, so the 8250_pci driver should not also try to grab it as well.
      Reported-by: default avatarStefan Seyfried <stefan.seyfried@googlemail.com>
      Cc: Wang YanQing <udknight@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      577048c5
    • Artem Bityutskiy's avatar
      UBIFS: fix a horrid bug · bfac32e7
      Artem Bityutskiy authored
      commit 605c912b upstream.
      
      Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no
      mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
      in the middle of 'ubifs_readdir()'.
      
      This means that 'file->private_data' can be freed while 'ubifs_readdir()' uses
      it, and this is a very bad bug: not only 'ubifs_readdir()' can return garbage,
      but this may corrupt memory and lead to all kinds of problems like crashes an
      security holes.
      
      This patch fixes the problem by using the 'file->f_version' field, which
      '->llseek()' always unconditionally sets to zero. We set it to 1 in
      'ubifs_readdir()' and whenever we detect that it became 0, we know there was a
      seek and it is time to clear the state saved in 'file->private_data'.
      
      I tested this patch by writing a user-space program which runds readdir and
      seek in parallell. I could easily crash the kernel without these patches, but
      could not crash it with these patches.
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Tested-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bfac32e7
    • Artem Bityutskiy's avatar
      UBIFS: prepare to fix a horrid bug · e869332d
      Artem Bityutskiy authored
      commit 33f1a63a upstream.
      
      Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no
      mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
      in the middle of 'ubifs_readdir()'.
      
      First of all, this means that 'file->private_data' can be freed while
      'ubifs_readdir()' uses it.  But this particular patch does not fix the problem.
      This patch is only a preparation, and the fix will follow next.
      
      In this patch we make 'ubifs_readdir()' stop using 'file->f_pos' directly,
      because 'file->f_pos' can be changed by '->llseek()' at any point. This may
      lead 'ubifs_readdir()' to returning inconsistent data: directory entry names
      may correspond to incorrect file positions.
      
      So here we introduce a local variable 'pos', read 'file->f_pose' once at very
      the beginning, and then stick to 'pos'. The result of this is that when
      'ubifs_dir_llseek()' changes 'file->f_pos' while we are in the middle of
      'ubifs_readdir()', the latter "wins".
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Tested-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e869332d