1. 12 Aug, 2014 40 commits
    • Yann Droneaud's avatar
      IB/mthca: Return an error on ib_copy_to_udata() failure · 0e4ae2f1
      Yann Droneaud authored
      In case of error when writing to userspace, the function mthca_create_cq()
      does not set an error code before following its error path.
      
      This patch sets the error code to -EFAULT when ib_copy_to_udata() fails.
      
      This was caught when using spatch (aka. coccinelle)
      to rewrite call to ib_copy_{from,to}_udata().
      
      Link: https://www.gitorious.org/opteya/coccib/source/75ebf2c1033c64c1d81df13e4ae44ee99c989eba:ib_copy_udata.cocci
      Link: http://marc.info/?i=cover.1394485254.git.ydroneaud@opteya.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarYann Droneaud <ydroneaud@opteya.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      
      (cherry picked from commit 08e74c4b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0e4ae2f1
    • Stanislav Kinsbursky's avatar
      nfsd: check passed socket's net matches NFSd superblock's one · 3bfaa91d
      Stanislav Kinsbursky authored
      There could be a case, when NFSd file system is mounted in network, different
      to socket's one, like below:
      
      "ip netns exec" creates new network and mount namespace, which duplicates NFSd
      mount point, created in init_net context. And thus NFS server stop in nested
      network context leads to RPCBIND client destruction in init_net.
      Then, on NFSd start in nested network context, rpc.nfsd process creates socket
      in nested net and passes it into "write_ports", which leads to RPCBIND sockets
      creation in init_net context because of the same reason (NFSd monut point was
      created in init_net context). An attempt to register passed socket in nested
      net leads to panic, because no RPCBIND client present in nexted network
      namespace.
      
      This patch add check that passed socket's net matches NFSd superblock's one.
      And returns -EINVAL error to user psace otherwise.
      
      v2: Put socket on exit.
      Reported-by: default avatarWeng Meiling <wengmeiling.weng@huawei.com>
      Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 30646394)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3bfaa91d
    • Neil Horman's avatar
      x86: Adjust irq remapping quirk for older revisions of 5500/5520 chipsets · bb8e2f6d
      Neil Horman authored
      Commit 03bbcb2e (iommu/vt-d: add quirk for broken interrupt
      remapping on 55XX chipsets) properly disables irq remapping on the
      5500/5520 chipsets that don't correctly perform that feature.
      
      However, when I wrote it, I followed the errata sheet linked in that
      commit too closely, and explicitly tied the activation of the quirk to
      revision 0x13 of the chip, under the assumption that earlier revisions
      were not in the field.  Recently a system was reported to be suffering
      from this remap bug and the quirk hadn't triggered, because the
      revision id register read at a lower value that 0x13, so the quirk
      test failed improperly.  Given this, it seems only prudent to adjust
      this quirk so that any revision less than 0x13 has the quirk asserted.
      
      [ tglx: Removed the 0x12 comparison of pci id 3405 as this is covered
          	by the <= 0x13 check already ]
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1394649873-14913-1-git-send-email-nhorman@tuxdriver.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      (cherry picked from commit 6f8a1b33)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bb8e2f6d
    • W. Trevor King's avatar
      ALSA: hda - Enable beep for ASUS 1015E · fd51e898
      W. Trevor King authored
      The `lspci -nnvv` output contains (wrapped for line length):
      
        00:1b.0 Audio device [0403]:
          Intel Corporation 7 Series/C210 Series Chipset Family
          High Definition Audio Controller [8086:1e20] (rev 04)
              Subsystem: ASUSTeK Computer Inc. Device [1043:115d]
      Signed-off-by: default avatarW. Trevor King <wking@tremily.us>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit a4b7f21d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      fd51e898
    • Huacai Chen's avatar
      MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume() · db1b6103
      Huacai Chen authored
      The original MIPS hibernate code flushes cache and TLB entries in
      swsusp_arch_resume(). But they are removed in Commit 44eeab67
      (MIPS: Hibernation: Remove SMP TLB and cacheflushing code.). A cross-
      CPU flush is surely unnecessary because all but the local CPU have
      already been disabled. But a local flush (at least the TLB flush) is
      needed. When we do hibernation on Loongson-3 with an E1000E NIC, it is
      very easy to produce a kernel panic (kernel page fault, or unaligned
      access). The root cause is E1000E driver use vzalloc_node() to allocate
      pages, the stale TLB entries of the booting kernel will be misused by
      the resumed target kernel.
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Cc: John Crispin <john@phrozen.org>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/6643/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      
      (cherry picked from commit c14af233)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      db1b6103
    • J. Bruce Fields's avatar
      nfsd4: fix setclientid encode size · bf78917c
      J. Bruce Fields authored
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 480efaee)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bf78917c
    • Trond Myklebust's avatar
      NFSv4: Fix a use-after-free problem in open() · 864859b4
      Trond Myklebust authored
      If we interrupt the nfs4_wait_for_completion_rpc_task() call in
      nfs4_run_open_task(), then we don't prevent the RPC call from
      completing. So freeing up the opendata->f_attr.mdsthreshold
      in the error path in _nfs4_do_open() leads to a use-after-free
      when the XDR decoder tries to decode the mdsthreshold information
      from the server.
      
      Fixes: 82be417a (NFSv4.1 cache mdsthreshold values on OPEN)
      Tested-by: default avatarSteve Dickson <SteveD@redhat.com>
      Cc: stable@vger.kernel.org # 3.5+
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      
      (cherry picked from commit e911b815)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      864859b4
    • Mike Snitzer's avatar
      dm thin: fix dangling bio in process_deferred_bios error path · d25af969
      Mike Snitzer authored
      If unable to ensure_next_mapping() we must add the current bio, which
      was removed from the @bios list via bio_list_pop, back to the
      deferred_bios list before all the remaining @bios.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit fe76cd88)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d25af969
    • Jani Nikula's avatar
      drm/i915/tv: fix gen4 composite s-video tv-out · 10f84e40
      Jani Nikula authored
      This is *not* bisected, but the likely regression is
      
      commit c3561438
      Author: Zhao Yakui <yakui.zhao@intel.com>
      Date:   Tue Nov 24 09:48:48 2009 +0800
      
          drm/i915: Don't set up the TV port if it isn't in the BIOS table.
      
      The commit does not check for all TV device types that might be present
      in the VBT, disabling TV out for the missing ones. Add composite
      S-video.
      Reported-and-tested-by: default avatarMatthew Khouzam <matthew.khouzam@gmail.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73362
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      
      (cherry picked from commit e1f23f3d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      10f84e40
    • Jeff Layton's avatar
      lockd: ensure we tear down any live sockets when socket creation fails during lockd_up · 446d55a0
      Jeff Layton authored
      We had a Fedora ABRT report with a stack trace like this:
      
      kernel BUG at net/sunrpc/svc.c:550!
      invalid opcode: 0000 [#1] SMP
      [...]
      CPU: 2 PID: 913 Comm: rpc.nfsd Not tainted 3.13.6-200.fc20.x86_64 #1
      Hardware name: Hewlett-Packard HP ProBook 4740s/1846, BIOS 68IRR Ver. F.40 01/29/2013
      task: ffff880146b00000 ti: ffff88003f9b8000 task.ti: ffff88003f9b8000
      RIP: 0010:[<ffffffffa0305fa8>]  [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc]
      RSP: 0018:ffff88003f9b9de0  EFLAGS: 00010206
      RAX: ffff88003f829628 RBX: ffff88003f829600 RCX: 00000000000041ee
      RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000286
      RBP: ffff88003f9b9de8 R08: 0000000000017360 R09: ffff88014fa97360
      R10: ffffffff8114ce57 R11: ffffea00051c9c00 R12: ffff88003f829600
      R13: 00000000ffffff9e R14: ffffffff81cc7cc0 R15: 0000000000000000
      FS:  00007f4fde284840(0000) GS:ffff88014fa80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f4fdf5192f8 CR3: 00000000a569a000 CR4: 00000000001407e0
      Stack:
       ffff88003f792300 ffff88003f9b9e18 ffffffffa02de02a 0000000000000000
       ffffffff81cc7cc0 ffff88003f9cb000 0000000000000008 ffff88003f9b9e60
       ffffffffa033bb35 ffffffff8131c86c ffff88003f9cb000 ffff8800a5715008
      Call Trace:
       [<ffffffffa02de02a>] lockd_up+0xaa/0x330 [lockd]
       [<ffffffffa033bb35>] nfsd_svc+0x1b5/0x2f0 [nfsd]
       [<ffffffff8131c86c>] ? simple_strtoull+0x2c/0x50
       [<ffffffffa033c630>] ? write_pool_threads+0x280/0x280 [nfsd]
       [<ffffffffa033c6bb>] write_threads+0x8b/0xf0 [nfsd]
       [<ffffffff8114efa4>] ? __get_free_pages+0x14/0x50
       [<ffffffff8114eff6>] ? get_zeroed_page+0x16/0x20
       [<ffffffff811dec51>] ? simple_transaction_get+0xb1/0xd0
       [<ffffffffa033c098>] nfsctl_transaction_write+0x48/0x80 [nfsd]
       [<ffffffff811b8b34>] vfs_write+0xb4/0x1f0
       [<ffffffff811c3f99>] ? putname+0x29/0x40
       [<ffffffff811b9569>] SyS_write+0x49/0xa0
       [<ffffffff810fc2a6>] ? __audit_syscall_exit+0x1f6/0x2a0
       [<ffffffff816962e9>] system_call_fastpath+0x16/0x1b
      Code: 31 c0 e8 82 db 37 e1 e9 2a ff ff ff 48 8b 07 8b 57 14 48 c7 c7 d5 c6 31 a0 48 8b 70 20 31 c0 e8 65 db 37 e1 e9 f4 fe ff ff 0f 0b <0f> 0b 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 56 41 55
      RIP  [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc]
       RSP <ffff88003f9b9de0>
      
      Evidently, we created some lockd sockets and then failed to create
      others. make_socks then returned an error and we tried to tear down the
      svc, but svc->sv_permsocks was not empty so we ended up tripping over
      the BUG() in svc_destroy().
      
      Fix this by ensuring that we tear down any live sockets we created when
      socket creation is going to return an error.
      
      Fixes: 786185b5 (SUNRPC: move per-net operations from...)
      Reported-by: default avatarRaphos <raphoszap@laposte.net>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Reviewed-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 679b033d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      446d55a0
    • Kinglong Mee's avatar
      NFSD: Traverse unconfirmed client through hash-table · 448f24a3
      Kinglong Mee authored
      When stopping nfsd, I got BUG messages, and soft lockup messages,
      The problem is cuased by double rb_erase() in nfs4_state_destroy_net()
      and destroy_client().
      
      This patch just let nfsd traversing unconfirmed client through
      hash-table instead of rbtree.
      
      [ 2325.021995] BUG: unable to handle kernel NULL pointer dereference at
                (null)
      [ 2325.022809] IP: [<ffffffff8133c18c>] rb_erase+0x14c/0x390
      [ 2325.022982] PGD 7a91b067 PUD 7a33d067 PMD 0
      [ 2325.022982] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
      [ 2325.022982] Modules linked in: nfsd(OF) cfg80211 rfkill bridge stp
      llc snd_intel8x0 snd_ac97_codec ac97_bus auth_rpcgss nfs_acl serio_raw
      e1000 i2c_piix4 ppdev snd_pcm snd_timer lockd pcspkr joydev parport_pc
      snd parport i2c_core soundcore microcode sunrpc ata_generic pata_acpi
      [last unloaded: nfsd]
      [ 2325.022982] CPU: 1 PID: 2123 Comm: nfsd Tainted: GF          O
      3.14.0-rc8+ #2
      [ 2325.022982] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
      VirtualBox 12/01/2006
      [ 2325.022982] task: ffff88007b384800 ti: ffff8800797f6000 task.ti:
      ffff8800797f6000
      [ 2325.022982] RIP: 0010:[<ffffffff8133c18c>]  [<ffffffff8133c18c>]
      rb_erase+0x14c/0x390
      [ 2325.022982] RSP: 0018:ffff8800797f7d98  EFLAGS: 00010246
      [ 2325.022982] RAX: ffff880079c1f010 RBX: ffff880079f4c828 RCX:
      0000000000000000
      [ 2325.022982] RDX: 0000000000000000 RSI: ffff880079bcb070 RDI:
      ffff880079f4c810
      [ 2325.022982] RBP: ffff8800797f7d98 R08: 0000000000000000 R09:
      ffff88007964fc70
      [ 2325.022982] R10: 0000000000000000 R11: 0000000000000400 R12:
      ffff880079f4c800
      [ 2325.022982] R13: ffff880079bcb000 R14: ffff8800797f7da8 R15:
      ffff880079f4c860
      [ 2325.022982] FS:  0000000000000000(0000) GS:ffff88007f900000(0000)
      knlGS:0000000000000000
      [ 2325.022982] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 2325.022982] CR2: 0000000000000000 CR3: 000000007a3ef000 CR4:
      00000000000006e0
      [ 2325.022982] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
      0000000000000000
      [ 2325.022982] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
      0000000000000400
      [ 2325.022982] Stack:
      [ 2325.022982]  ffff8800797f7de0 ffffffffa0191c6e ffff8800797f7da8
      ffff8800797f7da8
      [ 2325.022982]  ffff880079f4c810 ffff880079bcb000 ffffffff81cc26c0
      ffff880079c1f010
      [ 2325.022982]  ffff880079bcb070 ffff8800797f7e28 ffffffffa01977f2
      ffff8800797f7df0
      [ 2325.022982] Call Trace:
      [ 2325.022982]  [<ffffffffa0191c6e>] destroy_client+0x32e/0x3b0 [nfsd]
      [ 2325.022982]  [<ffffffffa01977f2>] nfs4_state_shutdown_net+0x1a2/0x220
      [nfsd]
      [ 2325.022982]  [<ffffffffa01700b8>] nfsd_shutdown_net+0x38/0x70 [nfsd]
      [ 2325.022982]  [<ffffffffa017013e>] nfsd_last_thread+0x4e/0x80 [nfsd]
      [ 2325.022982]  [<ffffffffa001f1eb>] svc_shutdown_net+0x2b/0x30 [sunrpc]
      [ 2325.022982]  [<ffffffffa017064b>] nfsd_destroy+0x5b/0x80 [nfsd]
      [ 2325.022982]  [<ffffffffa0170773>] nfsd+0x103/0x130 [nfsd]
      [ 2325.022982]  [<ffffffffa0170670>] ? nfsd_destroy+0x80/0x80 [nfsd]
      [ 2325.022982]  [<ffffffff810a8232>] kthread+0xd2/0xf0
      [ 2325.022982]  [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40
      [ 2325.022982]  [<ffffffff816c493c>] ret_from_fork+0x7c/0xb0
      [ 2325.022982]  [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40
      [ 2325.022982] Code: 48 83 e1 fc 48 89 10 0f 84 02 01 00 00 48 3b 41 10
      0f 84 08 01 00 00 48 89 51 08 48 89 fa e9 74 ff ff ff 0f 1f 40 00 48 8b
      50 10 <f6> 02 01 0f 84 93 00 00 00 48 8b 7a 10 48 85 ff 74 05 f6 07 01
      [ 2325.022982] RIP  [<ffffffff8133c18c>] rb_erase+0x14c/0x390
      [ 2325.022982]  RSP <ffff8800797f7d98>
      [ 2325.022982] CR2: 0000000000000000
      [ 2325.022982] ---[ end trace 28c27ed011655e57 ]---
      
      [  228.064071] BUG: soft lockup - CPU#0 stuck for 22s! [nfsd:558]
      [  228.064428] Modules linked in: ip6t_rpfilter ip6t_REJECT cfg80211
      xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc
      ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6
      nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw
      ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4
      nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security
      iptable_raw nfsd(OF) auth_rpcgss nfs_acl lockd snd_intel8x0
      snd_ac97_codec ac97_bus joydev snd_pcm snd_timer e1000 sunrpc snd ppdev
      parport_pc serio_raw pcspkr i2c_piix4 microcode parport soundcore
      i2c_core ata_generic pata_acpi
      [  228.064539] CPU: 0 PID: 558 Comm: nfsd Tainted: GF          O
      3.14.0-rc8+ #2
      [  228.064539] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
      VirtualBox 12/01/2006
      [  228.064539] task: ffff880076adec00 ti: ffff880074616000 task.ti:
      ffff880074616000
      [  228.064539] RIP: 0010:[<ffffffff8133ba17>]  [<ffffffff8133ba17>]
      rb_next+0x27/0x50
      [  228.064539] RSP: 0018:ffff880074617de0  EFLAGS: 00000282
      [  228.064539] RAX: ffff880074478010 RBX: ffff88007446f860 RCX:
      0000000000000014
      [  228.064539] RDX: ffff880074478010 RSI: 0000000000000000 RDI:
      ffff880074478010
      [  228.064539] RBP: ffff880074617de0 R08: 0000000000000000 R09:
      0000000000000012
      [  228.064539] R10: 0000000000000001 R11: ffffffffffffffec R12:
      ffffea0001d11a00
      [  228.064539] R13: ffff88007f401400 R14: ffff88007446f800 R15:
      ffff880074617d50
      [  228.064539] FS:  0000000000000000(0000) GS:ffff88007f800000(0000)
      knlGS:0000000000000000
      [  228.064539] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [  228.064539] CR2: 00007fe9ac6ec000 CR3: 000000007a5d6000 CR4:
      00000000000006f0
      [  228.064539] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
      0000000000000000
      [  228.064539] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
      0000000000000400
      [  228.064539] Stack:
      [  228.064539]  ffff880074617e28 ffffffffa01ab7db ffff880074617df0
      ffff880074617df0
      [  228.064539]  ffff880079273000 ffffffff81cc26c0 ffffffff81cc26c0
      0000000000000000
      [  228.064539]  0000000000000000 ffff880074617e48 ffffffffa01840b8
      ffffffff81cc26c0
      [  228.064539] Call Trace:
      [  228.064539]  [<ffffffffa01ab7db>] nfs4_state_shutdown_net+0x18b/0x220
      [nfsd]
      [  228.064539]  [<ffffffffa01840b8>] nfsd_shutdown_net+0x38/0x70 [nfsd]
      [  228.064539]  [<ffffffffa018413e>] nfsd_last_thread+0x4e/0x80 [nfsd]
      [  228.064539]  [<ffffffffa00aa1eb>] svc_shutdown_net+0x2b/0x30 [sunrpc]
      [  228.064539]  [<ffffffffa018464b>] nfsd_destroy+0x5b/0x80 [nfsd]
      [  228.064539]  [<ffffffffa0184773>] nfsd+0x103/0x130 [nfsd]
      [  228.064539]  [<ffffffffa0184670>] ? nfsd_destroy+0x80/0x80 [nfsd]
      [  228.064539]  [<ffffffff810a8232>] kthread+0xd2/0xf0
      [  228.064539]  [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40
      [  228.064539]  [<ffffffff816c493c>] ret_from_fork+0x7c/0xb0
      [  228.064539]  [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40
      [  228.064539] Code: 1f 44 00 00 55 48 8b 17 48 89 e5 48 39 d7 74 3b 48
      8b 47 08 48 85 c0 75 0e eb 25 66 0f 1f 84 00 00 00 00 00 48 89 d0 48 8b
      50 10 <48> 85 d2 75 f4 5d c3 66 90 48 3b 78 08 75 f6 48 8b 10 48 89 c7
      
      Fixes: ac55fdc4 (nfsd: move the confirmed and unconfirmed hlists...)
      Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 2b905635)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      448f24a3
    • Joe Thornber's avatar
      dm: take care to copy the space map roots before locking the superblock · 5cd7e0da
      Joe Thornber authored
      In theory copying the space map root can fail, but in practice it never
      does because we're careful to check what size buffer is needed.
      
      But make certain we're able to copy the space map roots before
      locking the superblock.
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # drop dm-era and dm-cache changes as needed
      
      (cherry picked from commit 5a32083d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      5cd7e0da
    • Joe Thornber's avatar
      dm transaction manager: fix corruption due to non-atomic transaction commit · de98afa3
      Joe Thornber authored
      The persistent-data library used by dm-thin, dm-cache, etc is
      transactional.  If anything goes wrong, such as an io error when writing
      new metadata or a power failure, then we roll back to the last
      transaction.
      
      Atomicity when committing a transaction is achieved by:
      
      a) Never overwriting data from the previous transaction.
      b) Writing the superblock last, after all other metadata has hit the
         disk.
      
      This commit and the following commit ("dm: take care to copy the space
      map roots before locking the superblock") fix a bug associated with (b).
      When committing it was possible for the superblock to still be written
      in spite of an io error occurring during the preceeding metadata flush.
      With these commits we're careful not to take the write lock out on the
      superblock until after the metadata flush has completed.
      
      Change the transaction manager's semantics for dm_tm_commit() to assume
      all data has been flushed _before_ the single superblock that is passed
      in.
      
      As a prerequisite, split the block manager's block unlocking and
      flushing by simplifying dm_bm_flush_and_unlock() to dm_bm_flush().  Now
      the unlocking must be done separately.
      
      This issue was discovered by forcing io errors at the crucial time
      using dm-flakey.
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit a9d45396)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      de98afa3
    • J. Bruce Fields's avatar
      nfsd: notify_change needs elevated write count · c1385a59
      J. Bruce Fields authored
      Looks like this bug has been here since these write counts were
      introduced, not sure why it was just noticed now.
      
      Thanks also to Jan Kara for pointing out the problem.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarMatthew Rahtz <mrahtz@rapitasystems.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 9f67f189)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c1385a59
    • J. Bruce Fields's avatar
      nfsd4: fix test_stateid error reply encoding · 42c8c0af
      J. Bruce Fields authored
      If the entire operation fails then there's nothing to encode.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit a11fcce1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      42c8c0af
    • J. Bruce Fields's avatar
      nfsd4: leave reply buffer space for failed setattr · 8cf30322
      J. Bruce Fields authored
      This fixes an ommission from 18032ca0
      "NFSD: Server implementation of MAC Labeling", which increased the size
      of the setattr error reply without increasing COMPOUND_ERR_SLACK_SPACE.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 04819bf6)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8cf30322
    • J. Bruce Fields's avatar
      nfsd4: session needs room for following op to error out · 6c4ccda9
      J. Bruce Fields authored
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 4c69d585)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6c4ccda9
    • J. Bruce Fields's avatar
      nfsd4: buffer-length check for SUPPATTR_EXCLCREAT · 0c777e27
      J. Bruce Fields authored
      This was an omission from 8c18f205
      "nfsd41: SUPPATTR_EXCLCREAT attribute".
      
      Cc: Benny Halevy <bhalevy@primarydata.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit de3997a7)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0c777e27
    • Jason Wang's avatar
      x86, hyperv: Bypass the timer_irq_works() check · 1bea3723
      Jason Wang authored
      This patch bypass the timer_irq_works() check for hyperv guest since:
      
      - It was guaranteed to work.
      - timer_irq_works() may fail sometime due to the lpj calibration were inaccurate
        in a hyperv guest or a buggy host.
      
      In the future, we should get the tsc frequency from hypervisor and use preset
      lpj instead.
      
      [ hpa: I would prefer to not defer things to "the future" in the future... ]
      
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Link: http://lkml.kernel.org/r/1393558229-14755-1-git-send-email-jasowang@redhat.comSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      
      (cherry picked from commit ca3ba2a2)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1bea3723
    • Marek Vasut's avatar
      gpio: mxs: Allow for recursive enable_irq_wake() call · 7ec7c6f8
      Marek Vasut authored
      The scenario here is that someone calls enable_irq_wake() from somewhere
      in the code. This will result in the lockdep producing a backtrace as can
      be seen below. In my case, this problem is triggered when using the wl1271
      (TI WlCore) driver found in drivers/net/wireless/ti/ .
      
      The problem cause is rather obvious from the backtrace, but let's outline
      the dependency. enable_irq_wake() grabs the IRQ buslock in irq_set_irq_wake(),
      which in turns calls mxs_gpio_set_wake_irq() . But mxs_gpio_set_wake_irq()
      calls enable_irq_wake() again on the one-level-higher IRQ , thus it tries to
      grab the IRQ buslock again in irq_set_irq_wake() . Because the spinlock in
      irq_set_irq_wake()->irq_get_desc_buslock()->__irq_get_desc_lock() is not
      marked as recursive, lockdep will spew the stuff below.
      
      We know we can safely re-enter the lock, so use IRQ_GC_INIT_NESTED_LOCK to
      fix the spew.
      
       =============================================
       [ INFO: possible recursive locking detected ]
       3.10.33-00012-gf06b763-dirty #61 Not tainted
       ---------------------------------------------
       kworker/0:1/18 is trying to acquire lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       but task is already holding lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       other info that might help us debug this:
        Possible unsafe locking scenario:
      
              CPU0
              ----
         lock(&irq_desc_lock_class);
         lock(&irq_desc_lock_class);
      
        *** DEADLOCK ***
      
        May be due to missing lock nesting notation
      
       3 locks held by kworker/0:1/18:
        #0:  (events){.+.+.+}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #1:  ((&fw_work->work)){+.+.+.}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #2:  (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       stack backtrace:
       CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 3.10.33-00012-gf06b763-dirty #61
       Workqueue: events request_firmware_work_func
       [<c0013eb4>] (unwind_backtrace+0x0/0xf0) from [<c0011c74>] (show_stack+0x10/0x14)
       [<c0011c74>] (show_stack+0x10/0x14) from [<c005bb08>] (__lock_acquire+0x140c/0x1a64)
       [<c005bb08>] (__lock_acquire+0x140c/0x1a64) from [<c005c6a8>] (lock_acquire+0x9c/0x104)
       [<c005c6a8>] (lock_acquire+0x9c/0x104) from [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58)
       [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c00685f0>] (__irq_get_desc_lock+0x48/0x88)
       [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) from [<c0068e78>] (irq_set_irq_wake+0x20/0xf4)
       [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) from [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24)
       [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) from [<c0068cf4>] (set_irq_wake_real+0x30/0x44)
       [<c0068cf4>] (set_irq_wake_real+0x30/0x44) from [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4)
       [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) from [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c)
       [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) from [<c02be5e8>] (request_firmware_work_func+0x38/0x58)
       [<c02be5e8>] (request_firmware_work_func+0x38/0x58) from [<c0036394>] (process_one_work+0x1c0/0x4a4)
       [<c0036394>] (process_one_work+0x1c0/0x4a4) from [<c0036a4c>] (worker_thread+0x138/0x394)
       [<c0036a4c>] (worker_thread+0x138/0x394) from [<c003cb74>] (kthread+0xa4/0xb0)
       [<c003cb74>] (kthread+0xa4/0xb0) from [<c000ee00>] (ret_from_fork+0x14/0x34)
       wlcore: loaded
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      
      (cherry picked from commit a585f87c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      7ec7c6f8
    • Josef Bacik's avatar
      Btrfs: fix deadlock with nested trans handles · 684d9e33
      Josef Bacik authored
      Zach found this deadlock that would happen like this
      
      btrfs_end_transaction <- reduce trans->use_count to 0
        btrfs_run_delayed_refs
          btrfs_cow_block
            find_free_extent
      	btrfs_start_transaction <- increase trans->use_count to 1
                allocate chunk
      	btrfs_end_transaction <- decrease trans->use_count to 0
      	  btrfs_run_delayed_refs
      	    lock tree block we are cowing above ^^
      
      We need to only decrease trans->use_count if it is above 1, otherwise leave it
      alone.  This will make nested trans be the only ones who decrease their added
      ref, and will let us get rid of the trans->use_count++ hack if we have to commit
      the transaction.  Thanks,
      
      cc: stable@vger.kernel.org
      Reported-by: default avatarZach Brown <zab@redhat.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Tested-by: default avatarZach Brown <zab@redhat.com>
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      
      (cherry picked from commit 3bbb24b2)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      684d9e33
    • Richard Guy Briggs's avatar
      audit: convert PPIDs to the inital PID namespace. · 0208b462
      Richard Guy Briggs authored
      sys_getppid() returns the parent pid of the current process in its own pid
      namespace.  Since audit filters are based in the init pid namespace, a process
      could avoid a filter or trigger an unintended one by being in an alternate pid
      namespace or log meaningless information.
      
      Switch to task_ppid_nr() for PPIDs to anchor all audit filters in the
      init_pid_ns.
      
      (informed by ebiederman's 6c621b7e)
      Cc: stable@vger.kernel.org
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      
      (cherry picked from commit c92cdeb4)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0208b462
    • Richard Guy Briggs's avatar
      pid: get pid_t ppid of task in init_pid_ns · f4dd9657
      Richard Guy Briggs authored
      Added the functions task_ppid_nr_ns() and task_ppid_nr() to abstract the lookup
      of the PPID (real_parent's pid_t) of a process, including rcu locking, in the
      arbitrary and init_pid_ns.
      This provides an alternative to sys_getppid(), which is relative to the child
      process' pid namespace.
      
      (informed by ebiederman's 6c621b7e)
      Cc: stable@vger.kernel.org
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      
      (cherry picked from commit ad36d282)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f4dd9657
    • Brian Austin's avatar
      ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols · d271b441
      Brian Austin authored
      The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros
      Fixed the TLV for aout_tlv to show -102dB correctly
      
      Fixes: 1d99f243 (ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV)
      Reported-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarBrian Austin <brian.austin@cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 7272e051)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d271b441
    • Krzysztof Kozlowski's avatar
      mfd: tps65910: Fix possible invalid pointer dereference on regmap_add_irq_chip fail · 5fb0f8e8
      Krzysztof Kozlowski authored
      Fixes: 4aab3fad ("mfd: tps65910: Move interrupt implementation code to mfd file")
      
      tps65910_irq_init() sets 'tps65910->chip_irq' before calling
      regmap_add_irq_chip(). If the regmap_add_irq_chip() call fails in
      memory allocation of regmap_irq_chip_data members then:
      
      1. The 'tps65910->chip_irq' will still hold some value
      2. 'tps65910->irq_data' will be pointing to already freed memory
         (because regmap_add_irq_chip() will free it on error)
      
      This results in invalid memory access during driver remove because the
      tps65910_irq_exit() tests whether 'tps65910->chip_irq' is not zero.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit 483e2dfd)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      5fb0f8e8
    • Krzysztof Kozlowski's avatar
      mfd: max77693: Fix possible NULL pointer dereference on i2c_new_dummy error · 9b2a93f6
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C devices for MUIC and haptic
      with i2c_new_dummy() but it does not check the return value of this
      calls.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by devm_regmap_init_i2c() and i2c_unregister_device().
      
      If i2c_new_dummy() fails for MUIC or haptic devices, fail also the probe
      for main MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit ad09dd6a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9b2a93f6
    • Krzysztof Kozlowski's avatar
      mfd: 88pm860x: Fix possible NULL pointer dereference on i2c_new_dummy error · 01d88c20
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C device for companion chip
      with i2c_new_dummy() but it does not check the return value of this call.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by regmap_init_i2c().
      
      If i2c_new_dummy() fails for companion device, fail also the probe for
      main MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit 159ce52a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      01d88c20
    • Krzysztof Kozlowski's avatar
      mfd: 88pm860x: Fix I2C device resource leak on regmap init fail · 3e92a178
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C device for companion chip
      and then allocates a regmap for it. If regmap_init_i2c() fails then the
      I2C driver (allocated with i2c_new_dummy()) is not freed and this
      resource leaks.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit a7ab1c8b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3e92a178
    • Krzysztof Kozlowski's avatar
      mfd: max8925: Fix possible NULL pointer dereference on i2c_new_dummy error · 46860a3b
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C devices for RTC and ADC
      with i2c_new_dummy() but it does not check the return value of this
      calls.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by i2c_unregister_device().
      
      If i2c_new_dummy() fails for RTC or ADC devices, fail also the probe
      for main MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit 96cf3ded)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      46860a3b
    • Krzysztof Kozlowski's avatar
      mfd: max8998: Fix possible NULL pointer dereference on i2c_new_dummy error · b708e41d
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C device for RTC with i2c_new_dummy() but it does not check the return value of this call.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by i2c_unregister_device().
      
      If i2c_new_dummy() fails for RTC device, fail also the probe for
      main MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit ed26f87b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b708e41d
    • Krzysztof Kozlowski's avatar
      mfd: max77686: Fix possible NULL pointer dereference on i2c_new_dummy error · bb100939
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C device for RTC with
      i2c_new_dummy() but it does not check the return value of this call.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by i2c_unregister_device().
      
      If i2c_new_dummy() fails for RTC device, fail also the probe for main
      MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit b9e183a1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bb100939
    • Krzysztof Kozlowski's avatar
      mfd: max8997: Fix possible NULL pointer dereference on i2c_new_dummy error · 2829545f
      Krzysztof Kozlowski authored
      During probe the driver allocates dummy I2C devices for RTC, haptic and
      MUIC with i2c_new_dummy() but it does not check the return value of this
      calls.
      
      In case of error (i2c_new_device(): memory allocation failure or I2C
      address cannot be used) this function returns NULL which is later used
      by i2c_unregister_device().
      
      If i2c_new_dummy() fails for RTC, haptic or MUIC devices, fail also the
      probe for main MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit 97dc4ed3)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2829545f
    • Linus Walleij's avatar
      mfd: Include all drivers in subsystem menu · 0f1c1f09
      Linus Walleij authored
      It is currently not possible to select the SA1100 or Vexpress
      drivers in the MFD subsystem, because the menu for the entire
      subsystem ends before these options are presented.
      
      Move the main menu closing and the endif for HAS_IOMEM to the
      end of the file so these are selectable again.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit a6e6e660)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0f1c1f09
    • Brian Austin's avatar
      ASoC: cs42l52: Fix mask bits for SOC_VALUE_ENUM_SINGLE · ee478a9f
      Brian Austin authored
      The mask bits values were wrong for the SOC_VALUE_ENUM_SINGLE for the PCM/ADC Swap controls
      Reported-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBrian Austin <brian.austin@cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit d31a33dd)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ee478a9f
    • Brian Austin's avatar
      ASoC: cs42l73: Fix mask bits for SOC_VALUE_ENUM_SINGLE · 6e735c4f
      Brian Austin authored
      The mask bits values were wrong for the SOC_VALUE_ENUM_SINGLE for the mono mix controls.
      Reported-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBrian Austin <brian.austin@cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 1555b652)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6e735c4f
    • Charles Keepax's avatar
      regulator: arizona-ldo1: Correct default regulator init_data · af079af0
      Charles Keepax authored
      Both 5102 and 8997 have the regulator capable of supplying 1.8V, and the
      voltage step from the 5110 regulator is different from what is specified
      in the default description. This patch updates the default regulator
      description to match 5110 and selects the 1.8V capable description for
      8997.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit a35ff286)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      af079af0
    • Krzysztof Kozlowski's avatar
      mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error · 4ac01eb3
      Krzysztof Kozlowski authored
      During probe the sec-core driver allocates dummy I2C device for RTC with
      i2c_new_dummy() but return value is not checked. In case of error
      (i2c_new_device(): memory allocation failure or I2C address cannot be
      used) this function returns NULL which is later used by
      devm_regmap_init_i2c() or i2c_unregister_device().
      
      If i2c_new_dummy() fails for RTC device, fail also the probe for main
      MFD driver.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      
      (cherry picked from commit 65aba1e0)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4ac01eb3
    • Yann Droneaud's avatar
      IB/nes: Return an error on ib_copy_from_udata() failure instead of NULL · d9c10b75
      Yann Droneaud authored
      In case of error while accessing to userspace memory, function
      nes_create_qp() returns NULL instead of an error code wrapped through
      ERR_PTR().  But NULL is not expected by ib_uverbs_create_qp(), as it
      check for error with IS_ERR().
      
      As page 0 is likely not mapped, it is going to trigger an Oops when
      the kernel will try to dereference NULL pointer to access to struct
      ib_qp's fields.
      
      In some rare cases, page 0 could be mapped by userspace, which could
      turn this bug to a vulnerability that could be exploited: the function
      pointers in struct ib_device will be under userspace total control.
      
      This was caught when using spatch (aka. coccinelle)
      to rewrite calls to ib_copy_{from,to}_udata().
      
      Link: https://www.gitorious.org/opteya/ib-hw-nes-create-qp-null
      Link: https://www.gitorious.org/opteya/coccib/source/75ebf2c1033c64c1d81df13e4ae44ee99c989eba:ib_copy_udata.cocci
      Link: http://marc.info/?i=cover.1394485254.git.ydroneaud@opteya.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarYann Droneaud <ydroneaud@opteya.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      
      (cherry picked from commit 9d194d10)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d9c10b75
    • Dennis Dalessandro's avatar
      IB/ipath: Fix potential buffer overrun in sending diag packet routine · 1c4a9d83
      Dennis Dalessandro authored
      Guard against a potential buffer overrun.  The size to read from the
      user is passed in, and due to the padding that needs to be taken into
      account, as well as the place holder for the ICRC it is possible to
      overflow the 32bit value which would cause more data to be copied from
      user space than is allocated in the buffer.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarNico Golde <nico@ngolde.de>
      Reported-by: default avatarFabian Yamaguchi <fabs@goesec.de>
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      
      (cherry picked from commit a2cb0eb8)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1c4a9d83
    • Alan Stern's avatar
      USB: unbind all interfaces before rebinding any · 2ebf5d66
      Alan Stern authored
      When a driver doesn't have pre_reset, post_reset, or reset_resume
      methods, the USB core unbinds that driver when its device undergoes a
      reset or a reset-resume, and then rebinds it afterward.
      
      The existing straightforward implementation can lead to problems,
      because each interface gets unbound and rebound before the next
      interface is handled.  If a driver claims additional interfaces, the
      claim may fail because the old binding instance may still own the
      additional interface when the new instance tries to claim it.
      
      This patch fixes the problem by first unbinding all the interfaces
      that are marked (i.e., their needs_binding flag is set) and then
      rebinding all of them.
      
      The patch also makes the helper functions in driver.c a little more
      uniform and adjusts some out-of-date comments.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatar"Poulain, Loic" <loic.poulain@intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 6aec044c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2ebf5d66