1. 05 Jul, 2015 11 commits
    • Vineet Gupta's avatar
      ARC: add compiler barrier to LLSC based cmpxchg · c71c2487
      Vineet Gupta authored
      [ Upstream commit d57f7272 ]
      
      When auditing cmpxchg call sites, Chuck noted that gcc was optimizing
      away some of the desired LDs.
      
      |	do {
      |		new = old = *ipi_data_ptr;
      |		new |= 1U << msg;
      |	} while (cmpxchg(ipi_data_ptr, old, new) != old);
      
      was generating to below
      
      | 8015cef8:	ld         r2,[r4,0]  <-- First LD
      | 8015cefc:	bset       r1,r2,r1
      |
      | 8015cf00:	llock      r3,[r4]  <-- atomic op
      | 8015cf04:	brne       r3,r2,8015cf10
      | 8015cf08:	scond      r1,[r4]
      | 8015cf0c:	bnz        8015cf00
      |
      | 8015cf10:	brne       r3,r2,8015cf00  <-- Branch doesn't go to orig LD
      
      Although this was fixed by adding a ACCESS_ONCE in this call site, it
      seems safer (for now at least) to add compiler barrier to LLSC based
      cmpxchg
      Reported-by: default avatarChuck Jordan <cjordan@synopsys,com>
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c71c2487
    • Takashi Iwai's avatar
      PM / sleep: Increase default DPM watchdog timeout to 60 · 8e15f153
      Takashi Iwai authored
      [ Upstream commit fff3b16d ]
      
      Many harddisks (mostly WD ones) have firmware problems and take too
      long, more than 10 seconds, to resume from suspend.  And this often
      exceeds the default DPM watchdog timeout (12 seconds), resulting in a
      kernel panic out of sudden.
      
      Since most distros just take the default as is, we should give a bit
      more safer value.  This patch increases the default value from 12
      seconds to one minute, which has been confirmed to be long enough for
      such problematic disks.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=91921
      Fixes: 70fea60d (PM / Sleep: Detect device suspend/resume lockup and log event)
      Cc: 3.13+ <stable@vger.kernel.org> # 3.13+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8e15f153
    • Alexey Brodkin's avatar
      stmmac: troubleshoot unexpected bits in des0 & des1 · d89e99a3
      Alexey Brodkin authored
      [ Upstream commit f1590670 ]
      
      Current implementation of descriptor init procedure only takes
      care about setting/clearing ownership flag in "des0"/"des1"
      fields while it is perfectly possible to get unexpected bits
      set because of the following factors:
      
       [1] On driver probe underlying memory allocated with
           dma_alloc_coherent() might not be zeroed and so
           it will be filled with garbage.
      
       [2] During driver operation some bits could be set by SD/MMC
           controller (for example error flags etc).
      
      And unexpected and/or randomly set flags in "des0"/"des1"
      fields may lead to unpredictable behavior of GMAC DMA block.
      
      This change addresses both items above with:
      
       [1] Use of dma_zalloc_coherent() instead of simple
           dma_alloc_coherent() to make sure allocated memory is
           zeroed. That shouldn't affect performance because
           this allocation only happens once on driver probe.
      
       [2] Do explicit zeroing of both "des0" and "des1" fields
           of all buffer descriptors during initialization of
           DMA transfer.
      
      And while at it fixed identation of dma_free_coherent()
      counterpart as well.
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: arc-linux-dev@synopsys.com
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d89e99a3
    • Jingoo Han's avatar
      of/address: use atomic allocation in pci_register_io_range() · d42b6b46
      Jingoo Han authored
      [ Upstream commit 294240ff ]
      
      When kzalloc() is called under spin_lock(), GFP_ATOMIC should be
      used to avoid sleeping allocation.
      The call tree is:
        of_pci_range_to_resource()
          --> pci_register_io_range() <-- takes spin_lock(&io_range_lock);
             --> kzalloc()
      Signed-off-by: default avatarJingoo Han <jingoohan1@gmail.com>
      Cc: stable@vger.kernel.org # 3.18+
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d42b6b46
    • Eric W. Biederman's avatar
      netfilter: nf_qeueue: Drop queue entries on nf_unregister_hook · b396bdb5
      Eric W. Biederman authored
      [ Upstream commit 8405a8ff ]
      
      Add code to nf_unregister_hook to flush the nf_queue when a hook is
      unregistered.  This guarantees that the pointer that the nf_queue code
      retains into the nf_hook list will remain valid while a packet is
      queued.
      
      I tested what would happen if we do not flush queued packets and was
      trivially able to obtain the oops below.  All that was required was
      to stop the nf_queue listening process, to delete all of the nf_tables,
      and to awaken the nf_queue listening process.
      
      > BUG: unable to handle kernel paging request at 0000000100000001
      > IP: [<0000000100000001>] 0x100000001
      > PGD b9c35067 PUD 0
      > Oops: 0010 [#1] SMP
      > Modules linked in:
      > CPU: 0 PID: 519 Comm: lt-nfqnl_test Not tainted
      > task: ffff8800b9c8c050 ti: ffff8800ba9d8000 task.ti: ffff8800ba9d8000
      > RIP: 0010:[<0000000100000001>]  [<0000000100000001>] 0x100000001
      > RSP: 0018:ffff8800ba9dba40  EFLAGS: 00010a16
      > RAX: ffff8800bab48a00 RBX: ffff8800ba9dba90 RCX: ffff8800ba9dba90
      > RDX: ffff8800b9c10128 RSI: ffff8800ba940900 RDI: ffff8800bab48a00
      > RBP: ffff8800b9c10128 R08: ffffffff82976660 R09: ffff8800ba9dbb28
      > R10: dead000000100100 R11: dead000000200200 R12: ffff8800ba940900
      > R13: ffffffff8313fd50 R14: ffff8800b9c95200 R15: 0000000000000000
      > FS:  00007fb91fc34700(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
      > CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      > CR2: 0000000100000001 CR3: 00000000babfb000 CR4: 00000000000007f0
      > Stack:
      >  ffffffff8206ab0f ffffffff82982240 ffff8800bab48a00 ffff8800b9c100a8
      >  ffff8800b9c10100 0000000000000001 ffff8800ba940900 ffff8800b9c10128
      >  ffffffff8206bd65 ffff8800bfb0d5e0 ffff8800bab48a00 0000000000014dc0
      > Call Trace:
      >  [<ffffffff8206ab0f>] ? nf_iterate+0x4f/0xa0
      >  [<ffffffff8206bd65>] ? nf_reinject+0x125/0x190
      >  [<ffffffff8206dee5>] ? nfqnl_recv_verdict+0x255/0x360
      >  [<ffffffff81386290>] ? nla_parse+0x80/0xf0
      >  [<ffffffff8206c42c>] ? nfnetlink_rcv_msg+0x13c/0x240
      >  [<ffffffff811b2fec>] ? __memcg_kmem_get_cache+0x4c/0x150
      >  [<ffffffff8206c2f0>] ? nfnl_lock+0x20/0x20
      >  [<ffffffff82068159>] ? netlink_rcv_skb+0xa9/0xc0
      >  [<ffffffff820677bf>] ? netlink_unicast+0x12f/0x1c0
      >  [<ffffffff82067ade>] ? netlink_sendmsg+0x28e/0x650
      >  [<ffffffff81fdd814>] ? sock_sendmsg+0x44/0x50
      >  [<ffffffff81fde07b>] ? ___sys_sendmsg+0x2ab/0x2c0
      >  [<ffffffff810e8f73>] ? __wake_up+0x43/0x70
      >  [<ffffffff8141a134>] ? tty_write+0x1c4/0x2a0
      >  [<ffffffff81fde9f4>] ? __sys_sendmsg+0x44/0x80
      >  [<ffffffff823ff8d7>] ? system_call_fastpath+0x12/0x6a
      > Code:  Bad RIP value.
      > RIP  [<0000000100000001>] 0x100000001
      >  RSP <ffff8800ba9dba40>
      > CR2: 0000000100000001
      > ---[ end trace 08eb65d42362793f ]---
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b396bdb5
    • Ralf Baechle's avatar
      NET: ROSE: Don't dereference NULL neighbour pointer. · d46c266a
      Ralf Baechle authored
      [ Upstream commit d496f784 ]
      
      A ROSE socket doesn't necessarily always have a neighbour pointer so check
      if the neighbour pointer is valid before dereferencing it.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Tested-by: default avatarBernard Pidoux <f6bvp@free.fr>
      Cc: stable@vger.kernel.org #2.6.11+
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d46c266a
    • Dave Airlie's avatar
      drm/dp/mst: take lock around looking up the branch device on hpd irq · c44ed568
      Dave Airlie authored
      [ Upstream commit 9eb1e57f ]
      
      If we are doing an MST transaction and we've gotten HPD and we
      lookup the device from the incoming msg, we should take the mgr
      lock around it, so that mst_primary and mstb->ports are valid.
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c44ed568
    • Daniel Vetter's avatar
      drm/dp/mst: make sure mst_primary mstb is valid in work function · 0e266aad
      Daniel Vetter authored
      [ Upstream commit 9254ec49 ]
      
      This validates the mst_primary under the lock, and then calls
      into the check and send function. This makes the code a lot
      easier to understand the locking rules in.
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0e266aad
    • Darrick J. Wong's avatar
      ext4: don't retry file block mapping on bigalloc fs with non-extent file · 9b7da0c6
      Darrick J. Wong authored
      [ Upstream commit 292db1bc ]
      
      ext4 isn't willing to map clusters to a non-extent file.  Don't signal
      this with an out of space error, since the FS will retry the
      allocation (which didn't fail) forever.  Instead, return EUCLEAN so
      that the operation will fail immediately all the way back to userspace.
      
      (The fix is either to run e2fsck -E bmap2extent, or to chattr +e the file.)
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9b7da0c6
    • Eric Sandeen's avatar
      xfs: fix remote symlinks on V5/CRC filesystems · c56932bd
      Eric Sandeen authored
      [ Upstream commit 2ac56d3d ]
      
      If we create a CRC filesystem, mount it, and create a symlink with
      a path long enough that it can't live in the inode, we get a very
      strange result upon remount:
      
      # ls -l mnt
      total 4
      lrwxrwxrwx. 1 root root 929 Jun 15 16:58 link -> XSLM
      
      XSLM is the V5 symlink block header magic (which happens to be
      followed by a NUL, so the string looks terminated).
      
      xfs_readlink_bmap() advanced cur_chunk by the size of the header
      for CRC filesystems, but never actually used that pointer; it
      kept reading from bp->b_addr, which is the start of the block,
      rather than the start of the symlink data after the header.
      
      Looks like this problem goes back to v3.10.
      
      Fixing this gets us reading the proper link target, again.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c56932bd
    • James Hogan's avatar
      MIPS: Fix KVM guest fixmap address · 19194bca
      James Hogan authored
      [ Upstream commit 8e748c8d ]
      
      KVM guest kernels for trap & emulate run in user mode, with a modified
      set of kernel memory segments. However the fixmap address is still in
      the normal KSeg3 region at 0xfffe0000 regardless, causing problems when
      cache alias handling makes use of them when handling copy on write.
      
      Therefore define FIXADDR_TOP as 0x7ffe0000 in the guest kernel mapped
      region when CONFIG_KVM_GUEST is defined.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # v3.10+
      Patchwork: https://patchwork.linux-mips.org/patch/9887/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      19194bca
  2. 04 Jul, 2015 29 commits
    • Theodore Ts'o's avatar
      ext4: call sync_blockdev() before invalidate_bdev() in put_super() · a609b382
      Theodore Ts'o authored
      [ Upstream commit 89d96a6f ]
      
      Normally all of the buffers will have been forced out to disk before
      we call invalidate_bdev(), but there will be some cases, where a file
      system operation was aborted due to an ext4_error(), where there may
      still be some dirty buffers in the buffer cache for the device.  So
      try to force them out to memory before calling invalidate_bdev().
      
      This fixes a warning triggered by generic/081:
      
      WARNING: CPU: 1 PID: 3473 at /usr/projects/linux/ext4/fs/block_dev.c:56 __blkdev_put+0xb5/0x16f()
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a609b382
    • Will Deacon's avatar
      arm64: vdso: work-around broken ELF toolchains in Makefile · 23e190ff
      Will Deacon authored
      [ Upstream commit 6f1a6ae8 ]
      
      When building the kernel with a bare-metal (ELF) toolchain, the -shared
      option may not be passed down to collect2, resulting in silent corruption
      of the vDSO image (in particular, the DYNAMIC section is omitted).
      
      The effect of this corruption is that the dynamic linker fails to find
      the vDSO symbols and libc is instead used for the syscalls that we
      intended to optimise (e.g. gettimeofday). Functionally, there is no
      issue as the sigreturn trampoline is still intact and located by the
      kernel.
      
      This patch fixes the problem by explicitly passing -shared to the linker
      when building the vDSO.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarSzabolcs Nagy <Szabolcs.Nagy@arm.com>
      Reported-by: default avatarJames Greenlaigh <james.greenhalgh@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      23e190ff
    • Dmitry Tunin's avatar
      Bluetooth: ath3k: Add support of 04ca:300d AR3012 device · c1f90226
      Dmitry Tunin authored
      [ Upstream commit 7e730c7f ]
      
      BugLink: https://bugs.launchpad.net/bugs/1394368
      
      This device requires new firmware files
       AthrBT_0x11020100.dfu and ramps_0x11020100_40.dfu added to
      /lib/firmware/ar3k/ that are not included in linux-firmware yet.
      
      T: Bus=02 Lev=01 Prnt=01 Port=04 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
      D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
      P: Vendor=04ca ProdID=300d Rev= 0.01
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
      E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
      E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
      I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
      I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
      I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
      I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
      I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
      E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
      Signed-off-by: default avatarDmitry Tunin <hanipouspilot@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c1f90226
    • Dmitry Tunin's avatar
      Bluetooth: ath3k: add support of 04ca:300f AR3012 device · 731c094c
      Dmitry Tunin authored
      [ Upstream commit ec0810d2 ]
      
      BugLink: https://bugs.launchpad.net/bugs/1449730
      
      T:  Bus=01 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
      D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04ca ProdID=300f Rev=00.01
      C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      Signed-off-by: default avatarDmitry Tunin <hanipouspilot@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      731c094c
    • Trond Myklebust's avatar
      NFS: Ensure we set NFS_CONTEXT_RESEND_WRITES when requeuing writes · 2d336687
      Trond Myklebust authored
      [ Upstream commit c7070113 ]
      
      If a write attempt fails, and the write is queued up for resending to
      the server, as opposed to being dropped, then we need to set the
      appropriate flag so that nfs_file_fsync() does the right thing.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2d336687
    • Trond Myklebust's avatar
      pNFS: Fix a memory leak when attempted pnfs fails · 4533a947
      Trond Myklebust authored
      [ Upstream commit 1ca018d2 ]
      
      pnfs_do_write() expects the call to pnfs_write_through_mds() to free the
      pgio header and to release the layout segment before exiting. The problem
      is that nfs_pgio_data_destroy() doesn't actually do this; it only frees
      the memory allocated by nfs_generic_pgio().
      
      Ditto for pnfs_do_read()...
      
      Fix in both cases is to add a call to hdr->release(hdr).
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4533a947
    • Bjorn Helgaas's avatar
      x86/PCI: Use host bridge _CRS info on systems with >32 bit addressing · f522f71a
      Bjorn Helgaas authored
      [ Upstream commit 3d9fecf6 ]
      
      We enable _CRS on all systems from 2008 and later.  On older systems, we
      ignore _CRS and assume the whole physical address space (excluding RAM and
      other devices) is available for PCI devices, but on systems that support
      physical address spaces larger than 4GB, it's doubtful that the area above
      4GB is really available for PCI.
      
      After d56dbf5b ("PCI: Allocate 64-bit BARs above 4G when possible"), we
      try to use that space above 4GB *first*, so we're more likely to put a
      device there.
      
      On Juan's Toshiba Satellite Pro U200, BIOS left the graphics, sound, 1394,
      and card reader devices unassigned (but only after Windows had been
      booted).  Only the sound device had a 64-bit BAR, so it was the only device
      placed above 4GB, and hence the only device that didn't work.
      
      Keep _CRS enabled even on pre-2008 systems if they support physical address
      space larger than 4GB.
      
      Fixes: d56dbf5b ("PCI: Allocate 64-bit BARs above 4G when possible")
      Reported-and-tested-by: default avatarJuan Dayer <jdayer@outlook.com>
      Reported-and-tested-by: default avatarAlan Horsfield <alan@hazelgarth.co.uk>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=99221
      Link: https://bugzilla.opensuse.org/show_bug.cgi?id=907092Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.14+
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f522f71a
    • Mikulas Patocka's avatar
      dm stats: fix divide by zero if 'number_of_areas' arg is zero · 83891b4c
      Mikulas Patocka authored
      [ Upstream commit dd4c1b7d ]
      
      If the number_of_areas argument was zero the kernel would crash on
      div-by-zero.  Add better input validation.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # v3.12+
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      83891b4c
    • Marc Zyngier's avatar
      KVM: arm/arm64: vgic: Avoid injecting reserved IRQ numbers · c9fdda04
      Marc Zyngier authored
      [ Upstream commit 4839ddc2 ]
      
      Commit fd1d0ddf (KVM: arm/arm64: check IRQ number on userland
      injection) rightly limited the range of interrupts userspace can
      inject in a guest, but failed to consider the (unlikely) case where
      a guest is configured with 1024 interrupts.
      
      In this case, interrupts ranging from 1020 to 1023 are unuseable,
      as they have a special meaning for the GIC CPU interface.
      
      Make sure that these number cannot be used as an IRQ. Also delete
      a redundant (and similarily buggy) check in kvm_set_irq.
      Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: <stable@vger.kernel.org> # 4.1, 4.0, 3.19, 3.18
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c9fdda04
    • Joe Thornber's avatar
      dm space map metadata: fix occasional leak of a metadata block on resize · da010e81
      Joe Thornber authored
      [ Upstream commit 6096d91a ]
      
      The metadata space map has a simplified 'bootstrap' mode that is
      operational when extending the space maps.  Whilst in this mode it's
      possible for some refcount decrement operations to become queued (eg, as
      a result of shadowing one of the bitmap indexes).  These decrements were
      not being applied when switching out of bootstrap mode.
      
      The effect of this bug was the leaking of a 4k metadata block.  This is
      detected by the latest version of thin_check as a non fatal error.
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      da010e81
    • Dave P Martin's avatar
      arm64: mm: Fix freeing of the wrong memmap entries with !SPARSEMEM_VMEMMAP · 0815b75f
      Dave P Martin authored
      [ Upstream commit b9bcc919 ]
      
      The memmap freeing code in free_unused_memmap() computes the end of
      each memblock by adding the memblock size onto the base.  However,
      if SPARSEMEM is enabled then the value (start) used for the base
      may already have been rounded downwards to work out which memmap
      entries to free after the previous memblock.
      
      This may cause memmap entries that are in use to get freed.
      
      In general, you're not likely to hit this problem unless there
      are at least 2 memblocks and one of them is not aligned to a
      sparsemem section boundary.  Note that carve-outs can increase
      the number of memblocks by splitting the regions listed in the
      device tree.
      
      This problem doesn't occur with SPARSEMEM_VMEMMAP, because the
      vmemmap code deals with freeing the unused regions of the memmap
      instead of requiring the arch code to do it.
      
      This patch gets the memblock base out of the memblock directly when
      computing the block end address to ensure the correct value is used.
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0815b75f
    • Mark Rutland's avatar
      arm64: entry: fix context tracking for el0_sp_pc · e71254d2
      Mark Rutland authored
      [ Upstream commit 46b0567c ]
      
      Commit 6c81fe79 ("arm64: enable context tracking") did not
      update el0_sp_pc to use ct_user_exit, but this appears to have been
      unintentional. In commit 6ab6463a ("arm64: adjust el0_sync so
      that a function can be called") we made x0 available, and in the return
      to userspace we call ct_user_enter in the kernel_exit macro.
      
      Due to this, we currently don't correctly inform RCU of the user->kernel
      transition, and may erroneously account for time spent in the kernel as
      if we were in an extended quiescent state when CONFIG_CONTEXT_TRACKING
      is enabled.
      
      As we do record the kernel->user transition, a userspace application
      making accesses from an unaligned stack pointer can demonstrate the
      imbalance, provoking the following warning:
      
      ------------[ cut here ]------------
      WARNING: CPU: 2 PID: 3660 at kernel/context_tracking.c:75 context_tracking_enter+0xd8/0xe4()
      Modules linked in:
      CPU: 2 PID: 3660 Comm: a.out Not tainted 4.1.0-rc7+ #8
      Hardware name: ARM Juno development board (r0) (DT)
      Call trace:
      [<ffffffc000089914>] dump_backtrace+0x0/0x124
      [<ffffffc000089a48>] show_stack+0x10/0x1c
      [<ffffffc0005b3cbc>] dump_stack+0x84/0xc8
      [<ffffffc0000b3214>] warn_slowpath_common+0x98/0xd0
      [<ffffffc0000b330c>] warn_slowpath_null+0x14/0x20
      [<ffffffc00013ada4>] context_tracking_enter+0xd4/0xe4
      [<ffffffc0005b534c>] preempt_schedule_irq+0xd4/0x114
      [<ffffffc00008561c>] el1_preempt+0x4/0x28
      [<ffffffc0001b8040>] exit_files+0x38/0x4c
      [<ffffffc0000b5b94>] do_exit+0x430/0x978
      [<ffffffc0000b614c>] do_group_exit+0x40/0xd4
      [<ffffffc0000c0208>] get_signal+0x23c/0x4f4
      [<ffffffc0000890b4>] do_signal+0x1ac/0x518
      [<ffffffc000089650>] do_notify_resume+0x5c/0x68
      ---[ end trace 963c192600337066 ]---
      
      This patch adds the missing ct_user_exit to the el0_sp_pc entry path,
      correcting the context tracking for this case.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Fixes: 6c81fe79 ("arm64: enable context tracking")
      Cc: <stable@vger.kernel.org> # v3.17+
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e71254d2
    • Lorenzo Pieralisi's avatar
      ARM: kvm: psci: fix handling of unimplemented functions · 3cadf681
      Lorenzo Pieralisi authored
      [ Upstream commit e2d99736 ]
      
      According to the PSCI specification and the SMC/HVC calling
      convention, PSCI function_ids that are not implemented must
      return NOT_SUPPORTED as return value.
      
      Current KVM implementation takes an unhandled PSCI function_id
      as an error and injects an undefined instruction into the guest
      if PSCI implementation is called with a function_id that is not
      handled by the resident PSCI version (ie it is not implemented),
      which is not the behaviour expected by a guest when calling a
      PSCI function_id that is not implemented.
      
      This patch fixes this issue by returning NOT_SUPPORTED whenever
      the kvm PSCI call is executed for a function_id that is not
      implemented by the PSCI kvm layer.
      
      Cc: <stable@vger.kernel.org> # 3.18+
      Cc: Christoffer Dall <christoffer.dall@linaro.org>
      Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3cadf681
    • Frodo Lai's avatar
      Input: pixcir_i2c_ts - fix receive error · a85076d1
      Frodo Lai authored
      [ Upstream commit 469d7d22 ]
      
      The i2c_master_recv() uses readsize to receive data from i2c but compares
      to size of rdbuf which is always 27. This would cause problem when the
      max_fingers is not 5. Change the comparison value to readsize instead.
      
      Fixes: 36874c7e ("Input: pixcir_i2c_ts - support up to 5 fingers and
      hardware tracking IDs:)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFrodo Lai <frodo_lai@bcmcom.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a85076d1
    • Hon Ching \(Vicky\) Lo's avatar
      vTPM: set virtual device before passing to ibmvtpm_reset_crq · 1cce6f3b
      Hon Ching \(Vicky\) Lo authored
      [ Upstream commit 9d75f089 ]
      
      tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet
      set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq,
      the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.
      Signed-off-by: default avatarHon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
      Signed-off-by: default avatarJoy Latten <jmlatten@linux.vnet.ibm.com>
      Reviewed-by: default avatarAshley Lai <ashley@ahsleylai.com>
      Cc: <stable@vger.kernel.org>
      Fixes: 132f7629 ("drivers/char/tpm: Add new device driver to support IBM vTPM")
      Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1cce6f3b
    • Jeff Layton's avatar
      nfs: increase size of EXCHANGE_ID name string buffer · 90ff5990
      Jeff Layton authored
      [ Upstream commit 764ad8ba ]
      
      The current buffer is much too small if you have a relatively long
      hostname. Bring it up to the size of the one that SETCLIENTID has.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarMichael Skralivetsky <michael.skralivetsky@primarydata.com>
      Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      90ff5990
    • Mimi Zohar's avatar
      ima: fix ima_show_template_data_ascii() · cdbbbe19
      Mimi Zohar authored
      [ Upstream commit 45b26133 ]
      
      This patch fixes a bug introduced in "4d7aeee ima: define new template
      ima-ng and template fields d-ng and n-ng".
      
      Changelog:
      - change int to uint32 (Roberto Sassu's suggestion)
      Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: default avatarRoberto Sassu <rsassu@suse.de>
      Cc: stable@vger.kernel.org # 3.13
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      cdbbbe19
    • Maxime Coquelin's avatar
      regmap: Fix possible shift overflow in regmap_field_init() · c00a6861
      Maxime Coquelin authored
      [ Upstream commit 921cc294 ]
      
      The way the mask is generated in regmap_field_init() is wrong.
      Indeed, a field initialized with msb = 31 and lsb = 0 provokes a shift
      overflow while calculating the mask field.
      
      On some 32 bits architectures, such as x86, the generated mask is 0,
      instead of the expected 0xffffffff.
      
      This patch uses GENMASK() to fix the problem, as this macro is already safe
      regarding shift overflow.
      Signed-off-by: default avatarMaxime Coquelin <maxime.coquelin@st.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c00a6861
    • Arnd Bergmann's avatar
      ideapad: fix software rfkill setting · f099f4aa
      Arnd Bergmann authored
      [ Upstream commit 4b200b46 ]
      
      This fixes a several year old regression that I found while trying
      to get the Yoga 3 11 to work. The ideapad_rfk_set function is meant
      to send a command to the embedded controller through ACPI, but
      as of c1f73658, it sends the index of the rfkill device instead
      of the command, and ignores the opcode field.
      
      This changes it back to the original behavior, which indeed
      flips the rfkill state as seen in the debugfs interface.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: c1f73658 ("ideapad: pass ideapad_priv as argument (part 2)")
      Cc: stable@vger.kernel.org # v2.6.38+
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f099f4aa
    • Joseph Qi's avatar
      jbd2: fix ocfs2 corrupt when updating journal superblock fails · 12157205
      Joseph Qi authored
      [ Upstream commit 6f6a6fda ]
      
      If updating journal superblock fails after journal data has been
      flushed, the error is omitted and this will mislead the caller as a
      normal case.  In ocfs2, the checkpoint will be treated successfully
      and the other node can get the lock to update. Since the sb_start is
      still pointing to the old log block, it will rewrite the journal data
      during journal recovery by the other node. Thus the new updates will
      be overwritten and ocfs2 corrupts.  So in above case we have to return
      the error, and ocfs2_commit_cache will take care of the error and
      prevent the other node to do update first.  And only after recovering
      journal it can do the new updates.
      
      The issue discussion mail can be found at:
      https://oss.oracle.com/pipermail/ocfs2-devel/2015-June/010856.html
      http://comments.gmane.org/gmane.comp.file-systems.ext4/48841
      
      [ Fixed bug in patch which allowed a non-negative error return from
        jbd2_cleanup_journal_tail() to leak out of jbd2_fjournal_flush(); this
        was causing xfstests ext4/306 to fail. -- Ted ]
      Reported-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
      Signed-off-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Tested-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      12157205
    • Arun Chandran's avatar
      regmap: Fix regmap_bulk_read in BE mode · bef8c3f0
      Arun Chandran authored
      [ Upstream commit 15b8d2c4 ]
      
      In big endian mode regmap_bulk_read gives incorrect data
      for byte reads.
      
      This is because memcpy of a single byte from an address
      after full word read gives different results when
      endianness differs. ie. we get little-end in LE and big-end in BE.
      Signed-off-by: default avatarArun Chandran <achandran@mvista.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bef8c3f0
    • Dmitry Monakhov's avatar
      jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail() · c84ed5e5
      Dmitry Monakhov authored
      [ Upstream commit b4f1afcd ]
      
      jbd2_cleanup_journal_tail() can be invoked by jbd2__journal_start()
      So allocations should be done with GFP_NOFS
      
      [Full stack trace snipped from 3.10-rh7]
      [<ffffffff815c4bd4>] dump_stack+0x19/0x1b
      [<ffffffff8105dba1>] warn_slowpath_common+0x61/0x80
      [<ffffffff8105dcca>] warn_slowpath_null+0x1a/0x20
      [<ffffffff815c2142>] slab_pre_alloc_hook.isra.31.part.32+0x15/0x17
      [<ffffffff8119c045>] kmem_cache_alloc+0x55/0x210
      [<ffffffff811477f5>] ? mempool_alloc_slab+0x15/0x20
      [<ffffffff811477f5>] mempool_alloc_slab+0x15/0x20
      [<ffffffff81147939>] mempool_alloc+0x69/0x170
      [<ffffffff815cb69e>] ? _raw_spin_unlock_irq+0xe/0x20
      [<ffffffff8109160d>] ? finish_task_switch+0x5d/0x150
      [<ffffffff811f1a8e>] bio_alloc_bioset+0x1be/0x2e0
      [<ffffffff8127ee49>] blkdev_issue_flush+0x99/0x120
      [<ffffffffa019a733>] jbd2_cleanup_journal_tail+0x93/0xa0 [jbd2] -->GFP_KERNEL
      [<ffffffffa019aca1>] jbd2_log_do_checkpoint+0x221/0x4a0 [jbd2]
      [<ffffffffa019afc7>] __jbd2_log_wait_for_space+0xa7/0x1e0 [jbd2]
      [<ffffffffa01952d8>] start_this_handle+0x2d8/0x550 [jbd2]
      [<ffffffff811b02a9>] ? __memcg_kmem_put_cache+0x29/0x30
      [<ffffffff8119c120>] ? kmem_cache_alloc+0x130/0x210
      [<ffffffffa019573a>] jbd2__journal_start+0xba/0x190 [jbd2]
      [<ffffffff811532ce>] ? lru_cache_add+0xe/0x10
      [<ffffffffa01c9549>] ? ext4_da_write_begin+0xf9/0x330 [ext4]
      [<ffffffffa01f2c77>] __ext4_journal_start_sb+0x77/0x160 [ext4]
      [<ffffffffa01c9549>] ext4_da_write_begin+0xf9/0x330 [ext4]
      [<ffffffff811446ec>] generic_file_buffered_write_iter+0x10c/0x270
      [<ffffffff81146918>] __generic_file_write_iter+0x178/0x390
      [<ffffffff81146c6b>] __generic_file_aio_write+0x8b/0xb0
      [<ffffffff81146ced>] generic_file_aio_write+0x5d/0xc0
      [<ffffffffa01bf289>] ext4_file_write+0xa9/0x450 [ext4]
      [<ffffffff811c31d9>] ? pipe_read+0x379/0x4f0
      [<ffffffff811b93f0>] do_sync_write+0x90/0xe0
      [<ffffffff811b9b6d>] vfs_write+0xbd/0x1e0
      [<ffffffff811ba5b8>] SyS_write+0x58/0xb0
      [<ffffffff815d4799>] system_call_fastpath+0x16/0x1b
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c84ed5e5
    • Alexander Usyskin's avatar
      mei: me: wait for power gating exit confirmation · 09f89b0e
      Alexander Usyskin authored
      [ Upstream commit 3dc196ea ]
      
      Fix the hbm power gating state machine so it will wait till it receives
      confirmation interrupt for the PG_ISOLATION_EXIT message.
      
      In process of the suspend flow the devices first have to exit from the
      power gating state (runtime pm resume).
      If we do not handle the confirmation interrupt after sending
      PG_ISOLATION_EXIT message, we may receive it already after the suspend
      flow has changed the device state and interrupt will be interpreted as a
      spurious event, consequently link reset will be invoked which will
      prevent the device from completing the suspend flow
      
      kernel: [6603] mei_reset:136: mei_me 0000:00:16.0: powering down: end of reset
      kernel: [476] mei_me_irq_thread_handler:643: mei_me 0000:00:16.0: function called after ISR to handle the interrupt processing.
      kernel: mei_me 0000:00:16.0: FW not ready: resetting
      
      Cc: <stable@vger.kernel.org> #3.18+
      Cc: Gabriele Mazzotta <gabriele.mzt@gmail.com>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=86241
      Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770397Tested-by: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      09f89b0e
    • Ryan Underwood's avatar
      Disable write buffering on Toshiba ToPIC95 · d178b265
      Ryan Underwood authored
      [ Upstream commit 2fb22a80 ]
      
      Disable write buffering on the Toshiba ToPIC95 if it is enabled by
      somebody (it is not supposed to be a power-on default according to
      the datasheet). On the ToPIC95, practically no 32-bit Cardbus card
      will work under heavy load without locking up the whole system if
      this is left enabled. I tried about a dozen. It does not affect
      16-bit cards. This is similar to the O2 bugs in early controller
      revisions it seems.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=55961
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRyan C. Underwood <nemesis@icequake.net>
      Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d178b265
    • Theodore Ts'o's avatar
      ext4: fix race between truncate and __ext4_journalled_writepage() · 1f037aa9
      Theodore Ts'o authored
      [ Upstream commit bdf96838 ]
      
      The commit cf108bca: "ext4: Invert the locking order of page_lock
      and transaction start" caused __ext4_journalled_writepage() to drop
      the page lock before the page was written back, as part of changing
      the locking order to jbd2_journal_start -> page_lock.  However, this
      introduced a potential race if there was a truncate racing with the
      data=journalled writeback mode.
      
      Fix this by grabbing the page lock after starting the journal handle,
      and then checking to see if page had gotten truncated out from under
      us.
      
      This fixes a number of different warnings or BUG_ON's when running
      xfstests generic/086 in data=journalled mode, including:
      
      jbd2_journal_dirty_metadata: vdc-8: bad jh for block 115643: transaction (ee3fe7
      c0, 164), jh->b_transaction (  (null), 0), jh->b_next_transaction (  (null), 0), jlist 0
      
      	      	      	  - and -
      
      kernel BUG at /usr/projects/linux/ext4/fs/jbd2/transaction.c:2200!
          ...
      Call Trace:
       [<c02b2ded>] ? __ext4_journalled_invalidatepage+0x117/0x117
       [<c02b2de5>] __ext4_journalled_invalidatepage+0x10f/0x117
       [<c02b2ded>] ? __ext4_journalled_invalidatepage+0x117/0x117
       [<c027d883>] ? lock_buffer+0x36/0x36
       [<c02b2dfa>] ext4_journalled_invalidatepage+0xd/0x22
       [<c0229139>] do_invalidatepage+0x22/0x26
       [<c0229198>] truncate_inode_page+0x5b/0x85
       [<c022934b>] truncate_inode_pages_range+0x156/0x38c
       [<c0229592>] truncate_inode_pages+0x11/0x15
       [<c022962d>] truncate_pagecache+0x55/0x71
       [<c02b913b>] ext4_setattr+0x4a9/0x560
       [<c01ca542>] ? current_kernel_time+0x10/0x44
       [<c026c4d8>] notify_change+0x1c7/0x2be
       [<c0256a00>] do_truncate+0x65/0x85
       [<c0226f31>] ? file_ra_state_init+0x12/0x29
      
      	      	      	  - and -
      
      WARNING: CPU: 1 PID: 1331 at /usr/projects/linux/ext4/fs/jbd2/transaction.c:1396
      irty_metadata+0x14a/0x1ae()
          ...
      Call Trace:
       [<c01b879f>] ? console_unlock+0x3a1/0x3ce
       [<c082cbb4>] dump_stack+0x48/0x60
       [<c0178b65>] warn_slowpath_common+0x89/0xa0
       [<c02ef2cf>] ? jbd2_journal_dirty_metadata+0x14a/0x1ae
       [<c0178bef>] warn_slowpath_null+0x14/0x18
       [<c02ef2cf>] jbd2_journal_dirty_metadata+0x14a/0x1ae
       [<c02d8615>] __ext4_handle_dirty_metadata+0xd4/0x19d
       [<c02b2f44>] write_end_fn+0x40/0x53
       [<c02b4a16>] ext4_walk_page_buffers+0x4e/0x6a
       [<c02b59e7>] ext4_writepage+0x354/0x3b8
       [<c02b2f04>] ? mpage_release_unused_pages+0xd4/0xd4
       [<c02b1b21>] ? wait_on_buffer+0x2c/0x2c
       [<c02b5a4b>] ? ext4_writepage+0x3b8/0x3b8
       [<c02b5a5b>] __writepage+0x10/0x2e
       [<c0225956>] write_cache_pages+0x22d/0x32c
       [<c02b5a4b>] ? ext4_writepage+0x3b8/0x3b8
       [<c02b6ee8>] ext4_writepages+0x102/0x607
       [<c019adfe>] ? sched_clock_local+0x10/0x10e
       [<c01a8a7c>] ? __lock_is_held+0x2e/0x44
       [<c01a8ad5>] ? lock_is_held+0x43/0x51
       [<c0226dff>] do_writepages+0x1c/0x29
       [<c0276bed>] __writeback_single_inode+0xc3/0x545
       [<c0277c07>] writeback_sb_inodes+0x21f/0x36d
          ...
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1f037aa9
    • Catalin Marinas's avatar
      arm64: Do not attempt to use init_mm in reset_context() · c9153c6f
      Catalin Marinas authored
      [ Upstream commit 565630d5 ]
      
      After secondary CPU boot or hotplug, the active_mm of the idle thread is
      &init_mm. The init_mm.pgd (swapper_pg_dir) is only meant for TTBR1_EL1
      and must not be set in TTBR0_EL1. Since when active_mm == &init_mm the
      TTBR0_EL1 is already set to the reserved value, there is no need to
      perform any context reset.
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c9153c6f
    • Zidan Wang's avatar
      ASoC: wm8960: the enum of "DAC Polarity" should be wm8960_enum[1] · f6f4983d
      Zidan Wang authored
      [ Upstream commit a077e81e ]
      
      the enum of "DAC Polarity" should be wm8960_enum[1].
      Signed-off-by: default avatarZidan Wang <zidan.wang@freescale.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f6f4983d
    • Lior Amsalem's avatar
      dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup · b0c1201f
      Lior Amsalem authored
      [ Upstream commit 9136291f ]
      
      This patch fixes a bug in the XOR driver where the cleanup function can be
      called and free descriptors that never been processed by the engine (which
      result in data errors).
      
      The cleanup function will free descriptors based on the ownership bit in
      the descriptors.
      
      Fixes: ff7b0479 ("dmaengine: DMA engine driver for Marvell XOR engine")
      Signed-off-by: default avatarLior Amsalem <alior@marvell.com>
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Reviewed-by: default avatarOfer Heifetz <oferh@marvell.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b0c1201f
    • Cyrille Pitchen's avatar
      i2c: at91: fix a race condition when using the DMA controller · c289da8b
      Cyrille Pitchen authored
      [ Upstream commit 93563a6a ]
      
      For TX transactions, the TXCOMP bit in the Status Register is cleared
      when the first data is written into the Transmit Holding Register.
      
      In the lines from at91_do_twi_transfer():
      at91_twi_write_data_dma(dev);
      at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP);
      
      the TXCOMP interrupt may be enabled before the DMA controller has
      actually started to write into the THR. In such a case, the TXCOMP bit
      is still set into the Status Register so the interrupt is triggered
      immediately. The driver understands that a transaction completion has
      occurred but this transaction hasn't started yet. Hence the TXCOMP
      interrupt is no longer enabled by at91_do_twi_transfer() but instead
      by at91_twi_write_data_dma_callback().
      
      Also, the TXCOMP bit in the Status Register in not a clear on read flag
      but a snapshot of the transmission state at the time the Status
      Register is read.
      When a NACK error is dectected by the I2C controller, the TXCOMP, NACK
      and TXRDY bits are set together to 1 in the SR. If enabled, the TXCOMP
      interrupt is triggered at the same time. Also setting the TXRDY to 1
      triggers the DMA controller to write the next data into the THR. Such
      a write resets the TXCOMP bit to 0 in the SR. So depending on when the
      interrupt handler reads the SR, it may fail to detect the NACK error
      if it relies on the TXCOMP bit. The NACK bit and its interrupt should
      be used instead.
      
      For RX transactions, the TXCOMP bit in the Status Register is cleared
      when the START bit is set into the Control Register. However to unify
      the management of the TXCOMP bit when the DMA controller is used, the
      TXCOMP interrupt is now enabled by the DMA callbacks for both TX and
      RX transfers.
      Signed-off-by: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
      Cc: stable@vger.kernel.org #3.10 and later
      Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c289da8b