1. 03 Jan, 2014 40 commits
    • Johannes Berg's avatar
      mac80211: don't attempt to reorder multicast frames · aea59757
      Johannes Berg authored
      commit 051a41fa upstream.
      
      Multicast frames can't be transmitted as part of an aggregation
      session (such a session couldn't even be set up) so don't try to
      reorder them. Trying to do so would cause the reorder to stop
      working correctly since multicast QoS frames (as transmitted by
      the Aruba APs this was found with) would cause sequence number
      confusion in the buffer.
      Reported-by: default avatarBlaise Gassend <blaise@suitabletech.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      aea59757
    • Mark Brown's avatar
      ASoC: wm8990: Mark the register map as dirty when powering down · 9d2a8873
      Mark Brown authored
      commit 2ab2b742 upstream.
      
      Otherwise we'll skip sync on resume.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9d2a8873
    • Michael Neuling's avatar
      powerpc/signals: Improved mark VSX not saved with small contexts fix · 286cfe15
      Michael Neuling authored
      commit ec67ad82 upstream.
      
      In a recent patch:
        commit c13f20ac
        Author: Michael Neuling <mikey@neuling.org>
        powerpc/signals: Mark VSX not saved with small contexts
      
      We fixed an issue but an improved solution was later discussed after the patch
      was merged.
      
      Firstly, this patch doesn't handle the 64bit signals case, which could also hit
      this issue (but has never been reported).
      
      Secondly, the original patch isn't clear what MSR VSX should be set to.  The
      new approach below always clears the MSR VSX bit (to indicate no VSX is in the
      context) and sets it only in the specific case where VSX is available (ie. when
      VSX has been used and the signal context passed has space to provide the
      state).
      
      This reverts the original patch and replaces it with the improved solution.  It
      also adds a 64 bit version.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      286cfe15
    • Samir Benmendil's avatar
      ahci: add Marvell 9230 to the AHCI PCI device list · 9ed46e8a
      Samir Benmendil authored
      commit 6d5278a6 upstream.
      
      Tested with a DAWICONTROL DC-624e on 3.10.10
      Signed-off-by: default avatarSamir Benmendil <samir.benmendil@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarLevente Kurusa <levex@linux.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9ed46e8a
    • Xiangliang Yu's avatar
      PCI: Define macro for Marvell vendor ID · 56f1f4bb
      Xiangliang Yu authored
      commit 8e7ee6f5 upstream.
      
      Define PCI_VENDOR_ID_MARVELL_EXT macro for 0x1b4b vendor ID
      Signed-off-by: default avatarXiangliang Yu <yuxiangl@marvell.com>
      Signed-off-by: default avatarMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      56f1f4bb
    • Alistair Popple's avatar
      ahci: add support for IBM Akebono platform device · 6b7cfe5a
      Alistair Popple authored
      commit 2435dcb9 upstream.
      
      The new IBM Akebono board has a PPC476GTR SoC with an AHCI compliant
      SATA controller. This patch adds a compatible property for the new SoC
      to the AHCI platform driver.
      Signed-off-by: default avatarAlistair Popple <alistair@popple.id.au>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6b7cfe5a
    • Junxiao Bi's avatar
      configfs: fix race between dentry put and lookup · fd7d0ba4
      Junxiao Bi authored
      commit 76ae281f upstream.
      
      A race window in configfs, it starts from one dentry is UNHASHED and end
      before configfs_d_iput is called.  In this window, if a lookup happen,
      since the original dentry was UNHASHED, so a new dentry will be
      allocated, and then in configfs_attach_attr(), sd->s_dentry will be
      updated to the new dentry.  Then in configfs_d_iput(),
      BUG_ON(sd->s_dentry != dentry) will be triggered and system panic.
      
      sys_open:                     sys_close:
       ...                           fput
                                      dput
                                       dentry_kill
                                        __d_drop <--- dentry unhashed here,
                                                 but sd->dentry still point
                                                 to this dentry.
      
       lookup_real
        configfs_lookup
         configfs_attach_attr---> update sd->s_dentry
                                  to new allocated dentry here.
      
                                         d_kill
                                           configfs_d_iput <--- BUG_ON(sd->s_dentry != dentry)
                                                           triggered here.
      
      To fix it, change configfs_d_iput to not update sd->s_dentry if
      sd->s_count > 2, that means there are another dentry is using the sd
      beside the one that is going to be put.  Use configfs_dirent_lock in
      configfs_attach_attr to sync with configfs_d_iput.
      
      With the following steps, you can reproduce the bug.
      
      1. enable ocfs2, this will mount configfs at /sys/kernel/config and
         fill configure in it.
      
      2. run the following script.
      	while [ 1 ]; do cat /sys/kernel/config/cluster/$your_cluster_name/idle_timeout_ms > /dev/null; done &
      	while [ 1 ]; do cat /sys/kernel/config/cluster/$your_cluster_name/idle_timeout_ms > /dev/null; done &
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      fd7d0ba4
    • Eric Seppanen's avatar
      iscsi-target: chap auth shouldn't match username with trailing garbage · 47e67db4
      Eric Seppanen authored
      commit 86784c6b upstream.
      
      In iSCSI negotiations with initiator CHAP enabled, usernames with
      trailing garbage are permitted, because the string comparison only
      checks the strlen of the configured username.
      
      e.g. "usernameXXXXX" will be permitted to match "username".
      
      Just check one more byte so the trailing null char is also matched.
      Signed-off-by: default avatarEric Seppanen <eric@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      47e67db4
    • Eric Seppanen's avatar
      iscsi-target: fix extract_param to handle buffer length corner case · 6d8fcca0
      Eric Seppanen authored
      commit 369653e4 upstream.
      
      extract_param() is called with max_length set to the total size of the
      output buffer.  It's not safe to allow a parameter length equal to the
      buffer size as the terminating null would be written one byte past the
      end of the output buffer.
      Signed-off-by: default avatarEric Seppanen <eric@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6d8fcca0
    • Michael Neuling's avatar
      powerpc/signals: Mark VSX not saved with small contexts · 3bf4e8c8
      Michael Neuling authored
      commit c13f20ac upstream.
      
      The VSX MSR bit in the user context indicates if the context contains VSX
      state.  Currently we set this when the process has touched VSX at any stage.
      
      Unfortunately, if the user has not provided enough space to save the VSX state,
      we can't save it but we currently still set the MSR VSX bit.
      
      This patch changes this to clear the MSR VSX bit when the user doesn't provide
      enough space.  This indicates that there is no valid VSX state in the user
      context.
      
      This is needed to support get/set/make/swapcontext for applications that use
      VSX but only provide a small context.  For example, getcontext in glibc
      provides a smaller context since the VSX registers don't need to be saved over
      the glibc function call.  But since the program calling getcontext may have
      used VSX, the kernel currently says the VSX state is valid when it's not.  If
      the returned context is then used in setcontext (ie. a small context without
      VSX but with MSR VSX set), the kernel will refuse the context.  This situation
      has been reported by the glibc community.
      
      Based on patch from Carlos O'Donell.
      Tested-by: default avatarHaren Myneni <haren@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3bf4e8c8
    • Anton Blanchard's avatar
      powerpc/pseries: Duplicate dtl entries sometimes sent to userspace · 36d04a55
      Anton Blanchard authored
      commit 84b07386 upstream.
      
      When reading from the dispatch trace log (dtl) userspace interface, I
      sometimes see duplicate entries. One example:
      
      # hexdump -C dtl.out
      
      00000000  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
      00000010  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
      00000020  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32
      
      00000030  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
      00000040  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
      00000050  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32
      
      The problem is in scan_dispatch_log() where we call dtl_consumer()
      but bail out before incrementing the index.
      
      To fix this I moved dtl_consumer() after the timebase comparison.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      36d04a55
    • Yinghai Lu's avatar
      PCI: Remove duplicate pci_disable_device() from pcie_portdrv_remove() · 22007773
      Yinghai Lu authored
      commit e7cc5cf7 upstream.
      
      The pcie_portdrv .probe() method calls pci_enable_device() once, in
      pcie_port_device_register(), but the .remove() method calls
      pci_disable_device() twice, in pcie_port_device_remove() and in
      pcie_portdrv_remove().
      
      That causes a "disabling already-disabled device" warning when removing a
      PCIe port device.  This happens all the time when removing Thunderbolt
      devices, but is also easy to reproduce with, e.g.,
      "echo 0000:00:1c.3 > /sys/bus/pci/drivers/pcieport/unbind"
      
      This patch removes the disable from pcie_portdrv_remove().
      
      [bhelgaas: changelog, tag for stable]
      Reported-by: default avatarDavid Bulkow <David.Bulkow@stratus.com>
      Reported-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      22007773
    • Trond Myklebust's avatar
      NFSv4: Update list of irrecoverable errors on DELEGRETURN · 3b327af6
      Trond Myklebust authored
      commit c97cf606 upstream.
      
      If the DELEGRETURN errors out with something like NFS4ERR_BAD_STATEID
      then there is no recovery possible. Just quit without returning an error.
      
      Also, note that the client must not assume that the NFSv4 lease has been
      renewed when it sees an error on DELEGRETURN.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3b327af6
    • Andy Adamson's avatar
      NFSv4 wait on recovery for async session errors · a687a58f
      Andy Adamson authored
      commit 4a82fd7c upstream.
      
      When the state manager is processing the NFS4CLNT_DELEGRETURN flag, session
      draining is off, but DELEGRETURN can still get a session error.
      The async handler calls nfs4_schedule_session_recovery returns -EAGAIN, and
      the DELEGRETURN done then restarts the RPC task in the prepare state.
      With the state manager still processing the NFS4CLNT_DELEGRETURN flag with
      session draining off, these DELEGRETURNs will cycle with errors filling up the
      session slots.
      
      This prevents OPEN reclaims (from nfs_delegation_claim_opens) required by the
      NFS4CLNT_DELEGRETURN state manager processing from completing, hanging the
      state manager in the __rpc_wait_for_completion_task in nfs4_run_open_task
      as seen in this kernel thread dump:
      
      kernel: 4.12.32.53-ma D 0000000000000000     0  3393      2 0x00000000
      kernel: ffff88013995fb60 0000000000000046 ffff880138cc5400 ffff88013a9df140
      kernel: ffff8800000265c0 ffffffff8116eef0 ffff88013fc10080 0000000300000001
      kernel: ffff88013a4ad058 ffff88013995ffd8 000000000000fbc8 ffff88013a4ad058
      kernel: Call Trace:
      kernel: [<ffffffff8116eef0>] ? cache_alloc_refill+0x1c0/0x240
      kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
      kernel: [<ffffffffa0358152>] rpc_wait_bit_killable+0x42/0xa0 [sunrpc]
      kernel: [<ffffffff8152914f>] __wait_on_bit+0x5f/0x90
      kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
      kernel: [<ffffffff815291f8>] out_of_line_wait_on_bit+0x78/0x90
      kernel: [<ffffffff8109b520>] ? wake_bit_function+0x0/0x50
      kernel: [<ffffffffa035810d>] __rpc_wait_for_completion_task+0x2d/0x30 [sunrpc]
      kernel: [<ffffffffa040d44c>] nfs4_run_open_task+0x11c/0x160 [nfs]
      kernel: [<ffffffffa04114e7>] nfs4_open_recover_helper+0x87/0x120 [nfs]
      kernel: [<ffffffffa0411646>] nfs4_open_recover+0xc6/0x150 [nfs]
      kernel: [<ffffffffa040cc6f>] ? nfs4_open_recoverdata_alloc+0x2f/0x60 [nfs]
      kernel: [<ffffffffa0414e1a>] nfs4_open_delegation_recall+0x6a/0xa0 [nfs]
      kernel: [<ffffffffa0424020>] nfs_end_delegation_return+0x120/0x2e0 [nfs]
      kernel: [<ffffffff8109580f>] ? queue_work+0x1f/0x30
      kernel: [<ffffffffa0424347>] nfs_client_return_marked_delegations+0xd7/0x110 [nfs]
      kernel: [<ffffffffa04225d8>] nfs4_run_state_manager+0x548/0x620 [nfs]
      kernel: [<ffffffffa0422090>] ? nfs4_run_state_manager+0x0/0x620 [nfs]
      kernel: [<ffffffff8109b0f6>] kthread+0x96/0xa0
      kernel: [<ffffffff8100c20a>] child_rip+0xa/0x20
      kernel: [<ffffffff8109b060>] ? kthread+0x0/0xa0
      kernel: [<ffffffff8100c200>] ? child_rip+0x0/0x20
      
      The state manager can not therefore process the DELEGRETURN session errors.
      Change the async handler to wait for recovery on session errors.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - There's no restart_call label]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a687a58f
    • Andreas Bießmann's avatar
      avr32: fix out-of-range jump in large kernels · 1c7fd312
      Andreas Bießmann authored
      commit d617b338 upstream.
      
      This patch fixes following error (for big kernels):
      
      ---8<---
      arch/avr32/boot/u-boot/head.o: In function `no_tag_table':
      (.init.text+0x44): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o
      arch/avr32/kernel/built-in.o: In function `bad_return':
      (.ex.text+0x236): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o
      --->8---
      
      It comes up when the kernel increases and 'panic()' is too far away to fit in
      the +/- 2MiB range. Which in turn issues from the 21-bit displacement in
      'br{cond4}' mnemonic which is one of the two ways to do jumps (rjmp has just
      10-bit displacement and therefore a way smaller range). This fact was stated
      before in 8d29b7b9.
      One solution to solve this is to add a local storage for the symbol address
      and just load the $pc with that value.
      Signed-off-by: default avatarAndreas Bießmann <andreas@biessmann.de>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1c7fd312
    • Andreas Bießmann's avatar
      avr32: setup crt for early panic() · 3f308887
      Andreas Bießmann authored
      commit 7a2a74f4 upstream.
      
      Before the CRT was (fully) set up in kernel_entry (bss cleared before in
      _start, but also not before jump to panic() in no_tag_table case).
      
      This patch fixes this up to have a fully working CRT when branching to panic()
      in no_tag_table.
      Signed-off-by: default avatarAndreas Bießmann <andreas@biessmann.de>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3f308887
    • J. Bruce Fields's avatar
      nfsd4: fix xdr decoding of large non-write compounds · bca06620
      J. Bruce Fields authored
      commit 365da4ad upstream.
      
      This fixes a regression from 24750082
      "nfsd4: fix decoding of compounds across page boundaries".  The previous
      code was correct: argp->pagelist is initialized in
      nfs4svc_deocde_compoundargs to rqstp->rq_arg.pages, and is therefore a
      pointer to the page *after* the page we are currently decoding.
      
      The reason that patch nevertheless fixed a problem with decoding
      compounds containing write was a bug in the write decoding introduced by
      5a80a54d "nfsd4: reorganize write
      decoding", after which write decoding no longer adhered to the rule that
      argp->pagelist point to the next page.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      [bwh: Backported to 3.2: adjust context; there is only one instance to fix]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bca06620
    • Christoph Hellwig's avatar
      nfsd: make sure to balance get/put_write_access · 9bbbbf7f
      Christoph Hellwig authored
      commit 987da479 upstream.
      
      Use a straight goto error label style in nfsd_setattr to make sure
      we always do the put_write_access call after we got it earlier.
      
      Note that the we have been failing to do that in the case
      nfsd_break_lease() returns an error, a bug introduced into 2.6.38 with
      6a76bebe "nfsd4: break lease on nfsd
      setattr".
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      [bwh: Backported to 3.2: notify_change() takes only 2 arguments]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9bbbbf7f
    • Christoph Hellwig's avatar
      nfsd: split up nfsd_setattr · 31b5291d
      Christoph Hellwig authored
      commit 818e5a22 upstream.
      
      Split out two helpers to make the code more readable and easier to verify
      for correctness.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      [bwh: Backported to 3.2: s/umode_t/int/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      31b5291d
    • Mikulas Patocka's avatar
      dm delay: fix a possible deadlock due to shared workqueue · 40715dd3
      Mikulas Patocka authored
      commit 718822c1 upstream.
      
      The dm-delay target uses a shared workqueue for multiple instances.  This
      can cause deadlock if two or more dm-delay targets are stacked on the top
      of each other.
      
      This patch changes dm-delay to use a per-instance workqueue.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      40715dd3
    • Steve French's avatar
      setfacl removes part of ACL when setting POSIX ACLs to Samba · baf48b7f
      Steve French authored
      commit b1d93356 upstream.
      
      setfacl over cifs mounts can remove the default ACL when setting the
      (non-default part of) the ACL and vice versa (we were leaving at 0
      rather than setting to -1 the count field for the unaffected
      half of the ACL.  For example notice the setfacl removed
      the default ACL in this sequence:
      
      steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir ; setfacl
      -m default:user:test:rwx,user:test:rwx /mnt/test-dir
      getfacl: Removing leading '/' from absolute path names
      user::rwx
      group::r-x
      other::r-x
      default:user::rwx
      default:user:test:rwx
      default:group::r-x
      default:mask::rwx
      default:other::r-x
      
      steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir
      getfacl: Removing leading '/' from absolute path names
      user::rwx
      user:test:rwx
      group::r-x
      mask::rwx
      other::r-x
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Acked-by: default avatarJeremy Allison <jra@samba.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      baf48b7f
    • Jerome Glisse's avatar
      radeon: workaround pinning failure on low ram gpu · c9cc1d7f
      Jerome Glisse authored
      commit 97b6ff6b upstream.
      
      GPU with low amount of ram can fails at pinning new framebuffer before
      unpinning old one. On such failure, retry with unpinning old one before
      pinning new one allowing to work around the issue. This is somewhat
      ugly but only affect those old GPU we care about.
      Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c9cc1d7f
    • Larry Finger's avatar
      rtlwifi: rtl8192cu: Fix more pointer arithmetic errors · d5f5d50e
      Larry Finger authored
      commit eafbdde9 upstream.
      
      This driver uses a number of macros to get and set various fields in the
      RX and TX descriptors. To work correctly, a u8 pointer to the descriptor
      must be used; however, in some cases a descriptor structure pointer is used
      instead. In addition, a duplicated statement is removed.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Reported-by: default avatarMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d5f5d50e
    • Daniel Vetter's avatar
      drm/i915: flush cursors harder · 14556987
      Daniel Vetter authored
      commit b2ea8ef5 upstream.
      
      Apparently they need the same treatment as primary planes. This fixes
      modesetting failures because of stuck cursors (!) on Thomas' i830M
      machine.
      
      I've figured while at it I'll also roll it out for the ivb 3 pipe
      version of this function. I didn't do this for i845/i865 since Bspec
      says the update mechanism works differently, and there's some
      additional rules about what can be updated in which order.
      Tested-by: default avatarThomas Richter <thor@math.tu-berlin.de>
      Cc:  Thomas Richter <thor@math.tu-berlin.de>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      14556987
    • Guenter Roeck's avatar
      hwmon: (lm90) Fix max6696 alarm handling · f35b19b0
      Guenter Roeck authored
      commit e41fae2b upstream.
      
      Bit 2 of status register 2 on MAX6696 (external diode 2 open)
      sets ALERT; the bit thus has to be listed in alert_alarms.
      Also display a message in the alert handler if the condition
      is encountered.
      
      Even though not all overtemperature conditions cause ALERT
      to be set, we should not ignore them in the alert handler.
      Display messages for all out-of-range conditions.
      Reported-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f35b19b0
    • Jonathan Austin's avatar
      ARM: integrator_cp: Set LCD{0,1} enable lines when turning on CLCD · 41e8cbd9
      Jonathan Austin authored
      commit 30aeadd4 upstream.
      
      This turns on the internal integrator LCD display(s). It seems that the code
      to do this got lost in refactoring of the CLCD driver.
      Signed-off-by: default avatarJonathan Austin <jonathan.austin@arm.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      41e8cbd9
    • Takashi Iwai's avatar
      ALSA: pcsp: Fix the order of input device unregistration · ad308321
      Takashi Iwai authored
      commit 6408eac2 upstream.
      
      The current code may access to the already freed object.  The input
      device must be accessed and unregistered before freeing the top level
      sound object.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ad308321
    • Ben Skeggs's avatar
    • Mathias Krause's avatar
      ipc, msg: fix message length check for negative values · f2414ee6
      Mathias Krause authored
      commit 4e9b45a1 upstream.
      
      On 64 bit systems the test for negative message sizes is bogus as the
      size, which may be positive when evaluated as a long, will get truncated
      to an int when passed to load_msg().  So a long might very well contain a
      positive value but when truncated to an int it would become negative.
      
      That in combination with a small negative value of msg_ctlmax (which will
      be promoted to an unsigned type for the comparison against msgsz, making
      it a big positive value and therefore make it pass the check) will lead to
      two problems: 1/ The kmalloc() call in alloc_msg() will allocate a too
      small buffer as the addition of alen is effectively a subtraction.  2/ The
      copy_from_user() call in load_msg() will first overflow the buffer with
      userland data and then, when the userland access generates an access
      violation, the fixup handler copy_user_handle_tail() will try to fill the
      remainder with zeros -- roughly 4GB.  That almost instantly results in a
      system crash or reset.
      
        ,-[ Reproducer (needs to be run as root) ]--
        | #include <sys/stat.h>
        | #include <sys/msg.h>
        | #include <unistd.h>
        | #include <fcntl.h>
        |
        | int main(void) {
        |     long msg = 1;
        |     int fd;
        |
        |     fd = open("/proc/sys/kernel/msgmax", O_WRONLY);
        |     write(fd, "-1", 2);
        |     close(fd);
        |
        |     msgsnd(0, &msg, 0xfffffff0, IPC_NOWAIT);
        |
        |     return 0;
        | }
        '---
      
      Fix the issue by preventing msgsz from getting truncated by consistently
      using size_t for the message length.  This way the size checks in
      do_msgsnd() could still be passed with a negative value for msg_ctlmax but
      we would fail on the buffer allocation in that case and error out.
      
      Also change the type of m_ts from int to size_t to avoid similar nastiness
      in other code paths -- it is used in similar constructs, i.e.  signed vs.
      unsigned checks.  It should never become negative under normal
      circumstances, though.
      
      Setting msg_ctlmax to a negative value is an odd configuration and should
      be prevented.  As that might break existing userland, it will be handled
      in a separate commit so it could easily be reverted and reworked without
      reintroducing the above described bug.
      
      Hardening mechanisms for user copy operations would have catched that bug
      early -- e.g.  checking slab object sizes on user copy operations as the
      usercopy feature of the PaX patch does.  Or, for that matter, detect the
      long vs.  int sign change due to truncation, as the size overflow plugin
      of the very same patch does.
      
      [akpm@linux-foundation.org: fix i386 min() warnings]
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Cc: Pax Team <pageexec@freemail.hu>
      Cc: Davidlohr Bueso <davidlohr@hp.com>
      Cc: Brad Spengler <spender@grsecurity.net>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - Drop changes to alloc_msg() and copy_msg(), which don't exist]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f2414ee6
    • Ilija Hadzic's avatar
      devpts: plug the memory leak in kill_sb · 5967d03f
      Ilija Hadzic authored
      commit 66da0e1f upstream.
      
      When devpts is unmounted, there may be a no-longer-used IDR tree hanging
      off the superblock we are about to kill.  This needs to be cleaned up
      before destroying the SB.
      
      The leak is usually not a big deal because unmounting devpts is typically
      done when shutting down the whole machine.  However, shutting down an LXC
      container instead of a physical machine exposes the problem (the garbage
      is detectable with kmemleak).
      Signed-off-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5967d03f
    • Kees Cook's avatar
      exec/ptrace: fix get_dumpable() incorrect tests · 983e0bc2
      Kees Cook authored
      commit d049f74f upstream.
      
      The get_dumpable() return value is not boolean.  Most users of the
      function actually want to be testing for non-SUID_DUMP_USER(1) rather than
      SUID_DUMP_DISABLE(0).  The SUID_DUMP_ROOT(2) is also considered a
      protected state.  Almost all places did this correctly, excepting the two
      places fixed in this patch.
      
      Wrong logic:
          if (dumpable == SUID_DUMP_DISABLE) { /* be protective */ }
              or
          if (dumpable == 0) { /* be protective */ }
              or
          if (!dumpable) { /* be protective */ }
      
      Correct logic:
          if (dumpable != SUID_DUMP_USER) { /* be protective */ }
              or
          if (dumpable != 1) { /* be protective */ }
      
      Without this patch, if the system had set the sysctl fs/suid_dumpable=2, a
      user was able to ptrace attach to processes that had dropped privileges to
      that user.  (This may have been partially mitigated if Yama was enabled.)
      
      The macros have been moved into the file that declares get/set_dumpable(),
      which means things like the ia64 code can see them too.
      
      CVE-2013-2929
      Reported-by: default avatarVasily Kulikov <segoon@openwall.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      983e0bc2
    • Johan Hovold's avatar
      backlight: atmel-pwm-bl: fix gpio polarity in remove · fa012069
      Johan Hovold authored
      commit ad5066d4 upstream.
      
      Make sure to honour gpio polarity also at remove so that the backlight is
      actually disabled on boards with active-low enable pin.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Acked-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      fa012069
    • Johan Hovold's avatar
      backlight: atmel-pwm-bl: fix reported brightness · 281f5afc
      Johan Hovold authored
      commit 185d9144 upstream.
      
      The driver supports 16-bit brightness values, but the value returned
      from get_brightness was truncated to eight bits.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Cc: Jingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      281f5afc
    • Ryan Mallon's avatar
      vsprintf: check real user/group id for %pK · 373dcf17
      Ryan Mallon authored
      commit 312b4e22 upstream.
      
      Some setuid binaries will allow reading of files which have read
      permission by the real user id.  This is problematic with files which
      use %pK because the file access permission is checked at open() time,
      but the kptr_restrict setting is checked at read() time.  If a setuid
      binary opens a %pK file as an unprivileged user, and then elevates
      permissions before reading the file, then kernel pointer values may be
      leaked.
      
      This happens for example with the setuid pppd application on Ubuntu 12.04:
      
        $ head -1 /proc/kallsyms
        00000000 T startup_32
      
        $ pppd file /proc/kallsyms
        pppd: In file /proc/kallsyms: unrecognized option 'c1000000'
      
      This will only leak the pointer value from the first line, but other
      setuid binaries may leak more information.
      
      Fix this by adding a check that in addition to the current process having
      CAP_SYSLOG, that effective user and group ids are equal to the real ids.
      If a setuid binary reads the contents of a file which uses %pK then the
      pointer values will be printed as NULL if the real user is unprivileged.
      
      Update the sysctl documentation to reflect the changes, and also correct
      the documentation to state the kptr_restrict=0 is the default.
      
      This is a only temporary solution to the issue.  The correct solution is
      to do the permission check at open() time on files, and to replace %pK
      with a function which checks the open() time permission.  %pK uses in
      printk should be removed since no sane permission check can be done, and
      instead protected by using dmesg_restrict.
      Signed-off-by: default avatarRyan Mallon <rmallon@gmail.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Joe Perches <joe@perches.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - Compare ids directly instead of using {uid,gid}_eq()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      373dcf17
    • Mauro Carvalho Chehab's avatar
      cris: media platform drivers: fix build · faf9abb6
      Mauro Carvalho Chehab authored
      commit 72a0c557 upstream.
      
      On cris arch, the functions below aren't defined:
      
        drivers/media/platform/sh_veu.c: In function 'sh_veu_reg_read':
      
        drivers/media/platform/sh_veu.c:228:2: error: implicit declaration of function 'ioread32' [-Werror=implicit-function-declaration]
        drivers/media/platform/sh_veu.c: In function 'sh_veu_reg_write':
      
        drivers/media/platform/sh_veu.c:234:2: error: implicit declaration of function 'iowrite32' [-Werror=implicit-function-declaration]
        drivers/media/platform/vsp1/vsp1.h: In function 'vsp1_read':
        drivers/media/platform/vsp1/vsp1.h:66:2: error: implicit declaration of function 'ioread32' [-Werror=implicit-function-declaration]
        drivers/media/platform/vsp1/vsp1.h: In function 'vsp1_write':
        drivers/media/platform/vsp1/vsp1.h:71:2: error: implicit declaration of function 'iowrite32' [-Werror=implicit-function-declaration]
        drivers/media/platform/vsp1/vsp1.h: In function 'vsp1_read':
        drivers/media/platform/vsp1/vsp1.h:66:2: error: implicit declaration of function 'ioread32' [-Werror=implicit-function-declaration]
        drivers/media/platform/vsp1/vsp1.h: In function 'vsp1_write':
        drivers/media/platform/vsp1/vsp1.h:71:2: error: implicit declaration of function 'iowrite32' [-Werror=implicit-function-declaration]
        drivers/media/platform/soc_camera/rcar_vin.c: In function 'rcar_vin_setup':
        drivers/media/platform/soc_camera/rcar_vin.c:284:3: error: implicit declaration of function 'iowrite32' [-Werror=implicit-function-declaration]
      
        drivers/media/platform/soc_camera/rcar_vin.c: In function 'rcar_vin_request_capture_stop':
        drivers/media/platform/soc_camera/rcar_vin.c:353:2: error: implicit declaration of function 'ioread32' [-Werror=implicit-function-declaration]
      
      Yet, they're available, as CONFIG_GENERIC_IOMAP is defined.  What happens
      is that asm/io.h was not including asm-generic/iomap.h.
      Suggested-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      faf9abb6
    • Thomas Renninger's avatar
      x86/microcode/amd: Tone down printk(), don't treat a missing firmware file as an error · 43f8e23a
      Thomas Renninger authored
      commit 11f918d3 upstream.
      
      Do it the same way as done in microcode_intel.c: use pr_debug()
      for missing firmware files.
      
      There seem to be CPUs out there for which no microcode update
      has been submitted to kernel-firmware repo yet resulting in
      scary sounding error messages in dmesg:
      
        microcode: failed to load file amd-ucode/microcode_amd_fam16h.bin
      Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Link: http://lkml.kernel.org/r/1384274383-43510-1-git-send-email-trenn@suse.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      43f8e23a
    • Takashi Iwai's avatar
      ALSA: msnd: Avoid duplicated driver name · 5c7fd2a8
      Takashi Iwai authored
      commit 092f9cd1 upstream.
      
      msnd_pinnacle.c is used for both snd-msnd-pinnacle and
      snd-msnd-classic drivers, and both should have different driver
      names.  Using the same driver name results in the sysfs warning for
      duplicated entries like
       kobject: 'msnd-pinnacle.7' (cec33408): kobject_release, parent   (null) (delayed)
       kobject: 'msnd-pinnacle' (cecd4980): kobject_release, parent cf3ad9b0 (delayed)
       ------------[ cut here ]------------
       WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:486 sysfs_warn_dup+0x7d/0xa0()
       sysfs: cannot create duplicate filename '/bus/isa/drivers/msnd-pinnacle'
       ......
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5c7fd2a8
    • Dan Williams's avatar
      prism54: set netdev type to "wlan" · 1a59149d
      Dan Williams authored
      commit 8e3ffa47 upstream.
      
      Userspace uses the netdev devtype for stuff like device naming and type
      detection.  Be nice and set it.  Remove the pointless #if/#endif around
      SET_NETDEV_DEV too.
      Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1a59149d
    • Huang Shijie's avatar
      mtd: gpmi: fix kernel BUG due to racing DMA operations · 425b0e67
      Huang Shijie authored
      commit 7b3d2fb9 upstream.
      
      [1] The gpmi uses the nand_command_lp to issue the commands to NAND chips.
          The gpmi issues a DMA operation with gpmi_cmd_ctrl when it handles
          a NAND_CMD_NONE control command. So when we read a page(NAND_CMD_READ0)
          from the NAND, we may send two DMA operations back-to-back.
      
          If we do not serialize the two DMA operations, we will meet a bug when
      
          1.1) we enable CONFIG_DMA_API_DEBUG, CONFIG_DMADEVICES_DEBUG,
               and CONFIG_DEBUG_SG.
      
          1.2) Use the following commands in an UART console and a SSH console:
               cmd 1: while true;do dd if=/dev/mtd0 of=/dev/null;done
               cmd 1: while true;do dd if=/dev/mmcblk0 of=/dev/null;done
      
          The kernel log shows below:
          -----------------------------------------------------------------
          kernel BUG at lib/scatterlist.c:28!
          Unable to handle kernel NULL pointer dereference at virtual address 00000000
            .........................
          [<80044a0c>] (__bug+0x18/0x24) from [<80249b74>] (sg_next+0x48/0x4c)
          [<80249b74>] (sg_next+0x48/0x4c) from [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4)
          [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4) from [<8004af58>] (dma_unmap_sg+0x14/0x6c)
          [<8004af58>] (dma_unmap_sg+0x14/0x6c) from [<8027e594>] (mxs_dma_tasklet+0x18/0x1c)
          [<8027e594>] (mxs_dma_tasklet+0x18/0x1c) from [<8007d444>] (tasklet_action+0x114/0x164)
          -----------------------------------------------------------------
      
          1.3) Assume the two DMA operations is X (first) and Y (second).
      
               The root cause of the bug:
      	   Assume process P issues DMA X, and sleep on the completion
      	 @this->dma_done. X's tasklet callback is dma_irq_callback. It firstly
      	 wake up the process sleeping on the completion @this->dma_done,
      	 and then trid to unmap the scatterlist S. The waked process P will
      	 issue Y in another ARM core. Y initializes S->sg_magic to zero
      	 with sg_init_one(), while dma_irq_callback is unmapping S at the same
      	 time.
      
      	 See the diagram:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> | <-- (Y calls sg_init_one() to init
                                                 |      scatterlist S)
                                                 |
      
      [2] This patch serialize both the X and Y in the following way:
           Unmap the DMA scatterlist S firstly, and wake up the process at the end
           of the DMA callback, in such a way, Y will be executed after X.
      
           After this patch:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
                                                 | <-- (Y calls sg_init_one() to init
                                                 |     scatterlist S)
                                                 |
      Signed-off-by: default avatarHuang Shijie <b32955@freescale.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      425b0e67
    • Avinash Patil's avatar
      mwifiex: correct packet length for packets from SDIO interface · feb8633c
      Avinash Patil authored
      commit d03b4aa7 upstream.
      
      While receiving a packet on SDIO interface, we allocate skb with
      size multiple of SDIO block size. We need to resize this skb
      after RX using packet length from RX header.
      Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
      Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      feb8633c