1. 13 Sep, 2014 40 commits
    • Brennan Ashton's avatar
      USB: option: add VIA Telecom CDS7 chipset device id · c6902e93
      Brennan Ashton authored
      commit d7730273 upstream.
      
      This VIA Telecom baseband processor is used is used by by u-blox in both the
      FW2770 and FW2760 products and may be used in others as well.
      
      This patch has been tested on both of these modem versions.
      Signed-off-by: default avatarBrennan Ashton <bashton@brennanashton.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c6902e93
    • NeilBrown's avatar
      md/raid6: avoid data corruption during recovery of double-degraded RAID6 · 1417f897
      NeilBrown authored
      commit 9c4bdf69 upstream.
      
      During recovery of a double-degraded RAID6 it is possible for
      some blocks not to be recovered properly, leading to corruption.
      
      If a write happens to one block in a stripe that would be written to a
      missing device, and at the same time that stripe is recovering data
      to the other missing device, then that recovered data may not be written.
      
      This patch skips, in the double-degraded case, an optimisation that is
      only safe for single-degraded arrays.
      
      Bug was introduced in 2.6.32 and fix is suitable for any kernel since
      then.  In an older kernel with separate handle_stripe5() and
      handle_stripe6() functions the patch must change handle_stripe6().
      
      Fixes: 6c0069c0
      Cc: Yuri Tikhonov <yur@emcraft.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Reported-by: default avatar"Manibalan P" <pmanibalan@amiindia.co.in>
      Tested-by: default avatar"Manibalan P" <pmanibalan@amiindia.co.in>
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1090423Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1417f897
    • Pavel Shilovsky's avatar
      CIFS: Fix wrong directory attributes after rename · 9c50d4fd
      Pavel Shilovsky authored
      commit b46799a8 upstream.
      
      When we requests rename we also need to update attributes
      of both source and target parent directories. Not doing it
      causes generic/309 xfstest to fail on SMB2 mounts. Fix this
      by marking these directories for force revalidating.
      Signed-off-by: default avatarPavel Shilovsky <pshilovsky@samba.org>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9c50d4fd
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Avoid setting wrong COEF on ALC269 & co · d26e2c02
      Takashi Iwai authored
      commit f3ee07d8 upstream.
      
      ALC269 & co have many vendor-specific setups with COEF verbs.
      However, some verbs seem specific to some codec versions and they
      result in the codec stalling.  Typically, such a case can be avoided
      by checking the return value from reading a COEF.  If the return value
      is -1, it implies that the COEF is invalid, thus it shouldn't be
      written.
      
      This patch adds the invalid COEF checks in appropriate places
      accessing ALC269 and its variants.  The patch actually fixes the
      resume problem on Acer AO725 laptop.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=52181Tested-by: default avatarFrancesco Muzio <muziofg@gmail.com>
      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>
      d26e2c02
    • Filipe Manana's avatar
      Btrfs: fix csum tree corruption, duplicate and outdated checksums · b055da33
      Filipe Manana authored
      commit 27b9a812 upstream.
      
      Under rare circumstances we can end up leaving 2 versions of a checksum
      for the same file extent range.
      
      The reason for this is that after calling btrfs_next_leaf we process
      slot 0 of the leaf it returns, instead of processing the slot set in
      path->slots[0]. Most of the time (by far) path->slots[0] is 0, but after
      btrfs_next_leaf() releases the path and before it searches for the next
      leaf, another task might cause a split of the next leaf, which migrates
      some of its keys to the leaf we were processing before calling
      btrfs_next_leaf(). In this case btrfs_next_leaf() returns again the
      same leaf but with path->slots[0] having a slot number corresponding
      to the first new key it got, that is, a slot number that didn't exist
      before calling btrfs_next_leaf(), as the leaf now has more keys than
      it had before. So we must really process the returned leaf starting at
      path->slots[0] always, as it isn't always 0, and the key at slot 0 can
      have an offset much lower than our search offset/bytenr.
      
      For example, consider the following scenario, where we have:
      
      sums->bytenr: 40157184, sums->len: 16384, sums end: 40173568
      four 4kb file data blocks with offsets 40157184, 40161280, 40165376, 40169472
      
        Leaf N:
      
          slot = 0                           slot = btrfs_header_nritems() - 1
        |-------------------------------------------------------------------|
        | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4] |
        |-------------------------------------------------------------------|
      
        Leaf N + 1:
      
            slot = 0                          slot = btrfs_header_nritems() - 1
        |--------------------------------------------------------------------|
        | [(CSUM CSUM 40161280), size 32] ... [((CSUM CSUM 40615936), size 8 |
        |--------------------------------------------------------------------|
      
      Because we are at the last slot of leaf N, we call btrfs_next_leaf() to
      find the next highest key, which releases the current path and then searches
      for that next key. However after releasing the path and before finding that
      next key, the item at slot 0 of leaf N + 1 gets moved to leaf N, due to a call
      to ctree.c:push_leaf_left() (via ctree.c:split_leaf()), and therefore
      btrfs_next_leaf() will returns us a path again with leaf N but with the slot
      pointing to its new last key (CSUM CSUM 40161280). This new version of leaf N
      is then:
      
          slot = 0                        slot = btrfs_header_nritems() - 2  slot = btrfs_header_nritems() - 1
        |----------------------------------------------------------------------------------------------------|
        | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4]  [(CSUM CSUM 40161280), size 32] |
        |----------------------------------------------------------------------------------------------------|
      
      And incorrecly using slot 0, makes us set next_offset to 39239680 and we jump
      into the "insert:" label, which will set tmp to:
      
          tmp = min((sums->len - total_bytes) >> blocksize_bits,
              (next_offset - file_key.offset) >> blocksize_bits) =
          min((16384 - 0) >> 12, (39239680 - 40157184) >> 12) =
          min(4, (u64)-917504 = 18446744073708634112 >> 12) = 4
      
      and
      
         ins_size = csum_size * tmp = 4 * 4 = 16 bytes.
      
      In other words, we insert a new csum item in the tree with key
      (CSUM_OBJECTID CSUM_KEY 40157184 = sums->bytenr) that contains the checksums
      for all the data (4 blocks of 4096 bytes each = sums->len). Which is wrong,
      because the item with key (CSUM CSUM 40161280) (the one that was moved from
      leaf N + 1 to the end of leaf N) contains the old checksums of the last 12288
      bytes of our data and won't get those old checksums removed.
      
      So this leaves us 2 different checksums for 3 4kb blocks of data in the tree,
      and breaks the logical rule:
      
         Key_N+1.offset >= Key_N.offset + length_of_data_its_checksums_cover
      
      An obvious bad effect of this is that a subsequent csum tree lookup to get
      the checksum of any of the blocks with logical offset of 40161280, 40165376
      or 40169472 (the last 3 4kb blocks of file data), will get the old checksums.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b055da33
    • Daniel Mack's avatar
      ASoC: pxa-ssp: drop SNDRV_PCM_FMTBIT_S24_LE · 51387fbe
      Daniel Mack authored
      commit 9301503a upstream.
      
      This mode is unsupported, as the DMA controller can't do zero-padding
      of samples.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Reported-by: default avatarJohannes Stezenbach <js@sig21.net>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      51387fbe
    • Aneesh Kumar K.V's avatar
      powerpc/mm: Use read barrier when creating real_pte · f9b21184
      Aneesh Kumar K.V authored
      commit 85c1fafd upstream.
      
      On ppc64 we support 4K hash pte with 64K page size. That requires
      us to track the hash pte slot information on a per 4k basis. We do that
      by storing the slot details in the second half of pte page. The pte bit
      _PAGE_COMBO is used to indicate whether the second half need to be
      looked while building real_pte. We need to use read memory barrier while
      doing that so that load of hidx is not reordered w.r.t _PAGE_COMBO
      check. On the store side we already do a lwsync in __hash_page_4K
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [bwh: Backported to 3.2: include <asm/system.h> to ensure smp_rmb()
       is defined; cell_defconfig fails to build without this]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f9b21184
    • Aneesh Kumar K.V's avatar
    • Jan Kara's avatar
      reiserfs: Fix use after free in journal teardown · e1c88681
      Jan Kara authored
      commit 01777836 upstream.
      
      If do_journal_release() races with do_journal_end() which requeues
      delayed works for transaction flushing, we can leave work items for
      flushing outstanding transactions queued while freeing them. That
      results in use after free and possible crash in run_timers_softirq().
      
      Fix the problem by not requeueing works if superblock is being shut down
      (MS_ACTIVE not set) and using cancel_delayed_work_sync() in
      do_journal_release().
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      [bwh: Backported to 3.2:
       - Adjust context
       - commit_wq is global, not per-superblock
       - Change comment about 'these works'; we only have one work item
       - Drop inapplicable changes to reiserfs_schedule_old_flush()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e1c88681
    • Ronald Wahl's avatar
      carl9170: fix sending URBs with wrong type when using full-speed · 67fddd87
      Ronald Wahl authored
      commit 671796dd upstream.
      
      The driver assumes that endpoint 4 is always an interrupt endpoint.
      Unfortunately the type differs between high-speed and full-speed
      configurations while in the former case it is indeed an interrupt
      endpoint this is not true for the latter case - here it is a bulk
      endpoint. When sending URBs with the wrong type the kernel will
      generate a warning message including backtrace. In this specific
      case there will be a huge amount of warnings which can bring the system
      to freeze.
      
      To fix this we are now sending URBs to endpoint 4 using the type
      found in the endpoint descriptor.
      
      A side note: The carl9170 firmware currently specifies endpoint 4 as
      interrupt endpoint even in the full-speed configuration but this has
      no relevance because before this firmware is loaded the endpoint type
      is as described above and after the firmware is running the stick is not
      reenumerated and so the old descriptor is used.
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      67fddd87
    • David Vrabel's avatar
      x86/xen: resume timer irqs early · b36ec07b
      David Vrabel authored
      commit 8d5999df upstream.
      
      If the timer irqs are resumed during device resume it is possible in
      certain circumstances for the resume to hang early on, before device
      interrupts are resumed.  For an Ubuntu 14.04 PVHVM guest this would
      occur in ~0.5% of resume attempts.
      
      It is not entirely clear what is occuring the point of the hang but I
      think a task necessary for the resume calls schedule_timeout(),
      waiting for a timer interrupt (which never arrives).  This failure may
      require specific tasks to be running on the other VCPUs to trigger
      (processes are not frozen during a suspend/resume if PREEMPT is
      disabled).
      
      Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in
      syscore_resume().
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b36ec07b
    • Steven Rostedt (Red Hat)'s avatar
      ring-buffer: Always reset iterator to reader page · d41fb3c8
      Steven Rostedt (Red Hat) authored
      commit 651e22f2 upstream.
      
      When performing a consuming read, the ring buffer swaps out a
      page from the ring buffer with a empty page and this page that
      was swapped out becomes the new reader page. The reader page
      is owned by the reader and since it was swapped out of the ring
      buffer, writers do not have access to it (there's an exception
      to that rule, but it's out of scope for this commit).
      
      When reading the "trace" file, it is a non consuming read, which
      means that the data in the ring buffer will not be modified.
      When the trace file is opened, a ring buffer iterator is allocated
      and writes to the ring buffer are disabled, such that the iterator
      will not have issues iterating over the data.
      
      Although the ring buffer disabled writes, it does not disable other
      reads, or even consuming reads. If a consuming read happens, then
      the iterator is reset and starts reading from the beginning again.
      
      My tests would sometimes trigger this bug on my i386 box:
      
      WARNING: CPU: 0 PID: 5175 at kernel/trace/trace.c:1527 __trace_find_cmdline+0x66/0xaa()
      Modules linked in:
      CPU: 0 PID: 5175 Comm: grep Not tainted 3.16.0-rc3-test+ #8
      Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
       00000000 00000000 f09c9e1c c18796b3 c1b5d74c f09c9e4c c103a0e3 c1b5154b
       f09c9e78 00001437 c1b5d74c 000005f7 c10bd85a c10bd85a c1cac57c f09c9eb0
       ed0e0000 f09c9e64 c103a185 00000009 f09c9e5c c1b5154b f09c9e78 f09c9e80^M
      Call Trace:
       [<c18796b3>] dump_stack+0x4b/0x75
       [<c103a0e3>] warn_slowpath_common+0x7e/0x95
       [<c10bd85a>] ? __trace_find_cmdline+0x66/0xaa
       [<c10bd85a>] ? __trace_find_cmdline+0x66/0xaa
       [<c103a185>] warn_slowpath_fmt+0x33/0x35
       [<c10bd85a>] __trace_find_cmdline+0x66/0xaa^M
       [<c10bed04>] trace_find_cmdline+0x40/0x64
       [<c10c3c16>] trace_print_context+0x27/0xec
       [<c10c4360>] ? trace_seq_printf+0x37/0x5b
       [<c10c0b15>] print_trace_line+0x319/0x39b
       [<c10ba3fb>] ? ring_buffer_read+0x47/0x50
       [<c10c13b1>] s_show+0x192/0x1ab
       [<c10bfd9a>] ? s_next+0x5a/0x7c
       [<c112e76e>] seq_read+0x267/0x34c
       [<c1115a25>] vfs_read+0x8c/0xef
       [<c112e507>] ? seq_lseek+0x154/0x154
       [<c1115ba2>] SyS_read+0x54/0x7f
       [<c188488e>] syscall_call+0x7/0xb
      ---[ end trace 3f507febd6b4cc83 ]---
      >>>> ##### CPU 1 buffer started ####
      
      Which was the __trace_find_cmdline() function complaining about the pid
      in the event record being negative.
      
      After adding more test cases, this would trigger more often. Strangely
      enough, it would never trigger on a single test, but instead would trigger
      only when running all the tests. I believe that was the case because it
      required one of the tests to be shutting down via delayed instances while
      a new test started up.
      
      After spending several days debugging this, I found that it was caused by
      the iterator becoming corrupted. Debugging further, I found out why
      the iterator became corrupted. It happened with the rb_iter_reset().
      
      As consuming reads may not read the full reader page, and only part
      of it, there's a "read" field to know where the last read took place.
      The iterator, must also start at the read position. In the rb_iter_reset()
      code, if the reader page was disconnected from the ring buffer, the iterator
      would start at the head page within the ring buffer (where writes still
      happen). But the mistake there was that it still used the "read" field
      to start the iterator on the head page, where it should always start
      at zero because readers never read from within the ring buffer where
      writes occur.
      
      I originally wrote a patch to have it set the iter->head to 0 instead
      of iter->head_page->read, but then I questioned why it wasn't always
      setting the iter to point to the reader page, as the reader page is
      still valid.  The list_empty(reader_page->list) just means that it was
      successful in swapping out. But the reader_page may still have data.
      
      There was a bug report a long time ago that was not reproducible that
      had something about trace_pipe (consuming read) not matching trace
      (iterator read). This may explain why that happened.
      
      Anyway, the correct answer to this bug is to always use the reader page
      an not reset the iterator to inside the writable ring buffer.
      
      Fixes: d769041f "ring_buffer: implement new locking"
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d41fb3c8
    • Steven Rostedt (Red Hat)'s avatar
      ring-buffer: Up rb_iter_peek() loop count to 3 · cb2dfe4e
      Steven Rostedt (Red Hat) authored
      commit 021de3d9 upstream.
      
      After writting a test to try to trigger the bug that caused the
      ring buffer iterator to become corrupted, I hit another bug:
      
       WARNING: CPU: 1 PID: 5281 at kernel/trace/ring_buffer.c:3766 rb_iter_peek+0x113/0x238()
       Modules linked in: ipt_MASQUERADE sunrpc [...]
       CPU: 1 PID: 5281 Comm: grep Tainted: G        W     3.16.0-rc3-test+ #143
       Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007
        0000000000000000 ffffffff81809a80 ffffffff81503fb0 0000000000000000
        ffffffff81040ca1 ffff8800796d6010 ffffffff810c138d ffff8800796d6010
        ffff880077438c80 ffff8800796d6010 ffff88007abbe600 0000000000000003
       Call Trace:
        [<ffffffff81503fb0>] ? dump_stack+0x4a/0x75
        [<ffffffff81040ca1>] ? warn_slowpath_common+0x7e/0x97
        [<ffffffff810c138d>] ? rb_iter_peek+0x113/0x238
        [<ffffffff810c138d>] ? rb_iter_peek+0x113/0x238
        [<ffffffff810c14df>] ? ring_buffer_iter_peek+0x2d/0x5c
        [<ffffffff810c6f73>] ? tracing_iter_reset+0x6e/0x96
        [<ffffffff810c74a3>] ? s_start+0xd7/0x17b
        [<ffffffff8112b13e>] ? kmem_cache_alloc_trace+0xda/0xea
        [<ffffffff8114cf94>] ? seq_read+0x148/0x361
        [<ffffffff81132d98>] ? vfs_read+0x93/0xf1
        [<ffffffff81132f1b>] ? SyS_read+0x60/0x8e
        [<ffffffff8150bf9f>] ? tracesys+0xdd/0xe2
      
      Debugging this bug, which triggers when the rb_iter_peek() loops too
      many times (more than 2 times), I discovered there's a case that can
      cause that function to legitimately loop 3 times!
      
      rb_iter_peek() is different than rb_buffer_peek() as the rb_buffer_peek()
      only deals with the reader page (it's for consuming reads). The
      rb_iter_peek() is for traversing the buffer without consuming it, and as
      such, it can loop for one more reason. That is, if we hit the end of
      the reader page or any page, it will go to the next page and try again.
      
      That is, we have this:
      
       1. iter->head > iter->head_page->page->commit
          (rb_inc_iter() which moves the iter to the next page)
          try again
      
       2. event = rb_iter_head_event()
          event->type_len == RINGBUF_TYPE_TIME_EXTEND
          rb_advance_iter()
          try again
      
       3. read the event.
      
      But we never get to 3, because the count is greater than 2 and we
      cause the WARNING and return NULL.
      
      Up the counter to 3.
      
      Fixes: 69d1b839 "ring-buffer: Bind time extend and data events together"
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      [bwh: Backported to 3.2: drop inapplicable spelling correction]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      cb2dfe4e
    • Christian Borntraeger's avatar
      s390/locking: Reenable optimistic spinning · 4f365d36
      Christian Borntraeger authored
      commit 36e7fdaa upstream.
      
      commit 4badad35 (locking/mutex: Disable
      optimistic spinning on some architectures) fenced spinning for
      architectures without proper cmpxchg.
      There is no need to disable mutex spinning on s390, though:
      The instructions CS,CSG and friends provide the proper guarantees.
      (We dont implement cmpxchg with locks).
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4f365d36
    • Axel Lin's avatar
      hwmon: (ads1015) Fix out-of-bounds array access · 35175850
      Axel Lin authored
      commit e9814295 upstream.
      
      Current code uses data_rate as array index in ads1015_read_adc() and uses pga
      as array index in ads1015_reg_to_mv, so we must make sure both data_rate and
      pga settings are in valid value range.
      Return -EINVAL if the setting is out-of-range.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      35175850
    • Axel Lin's avatar
      hwmon: (lm92) Prevent overflow problem when writing large limits · b2d64341
      Axel Lin authored
      commit 5b963089 upstream.
      
      On platforms with sizeof(int) < sizeof(long), writing a temperature
      limit larger than MAXINT will result in unpredictable limit values
      written to the chip. Avoid auto-conversion from long to int to fix
      the problem.
      
      The hysteresis temperature range depends on the value of
      data->temp[attr->index], since val is subtracted from it.
      Use a wider clamp, [-120000, 220000] should do to cover the
      possible range. Also add missing TEMP_TO_REG() on writes into
      cached hysteresis value.
      
      Also uses clamp_val to simplify the code a bit.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      [Guenter Roeck: Fixed double TEMP_TO_REG on hysteresis updates]
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      [bwh: Backported to 3.2:
       - s/temp\[attr->index\]/temp1_crit/
       - s/temp\[t_hyst\]/temp1_hyst/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b2d64341
    • Steve Wise's avatar
      RDMA/iwcm: Use a default listen backlog if needed · b86a5f24
      Steve Wise authored
      commit 2f0304d2 upstream.
      
      If the user creates a listening cm_id with backlog of 0 the IWCM ends
      up not allowing any connection requests at all.  The correct behavior
      is for the IWCM to pick a default value if the user backlog parameter
      is zero.
      
      Lustre from version 1.8.8 onward uses a backlog of 0, which breaks
      iwarp support without this fix.
      Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      [bwh: Backported to 3.2: use register_net_sysctl_table()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b86a5f24
    • Alex Deucher's avatar
      drm/radeon: load the lm63 driver for an lm64 thermal chip. · 9ff66a75
      Alex Deucher authored
      commit 5dc35532 upstream.
      
      Looks like the lm63 driver supports the lm64 as well.
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9ff66a75
    • Andrey Utkin's avatar
    • Tetsuo Handa's avatar
      drm/ttm: Fix possible stack overflow by recursive shrinker calls. · 312b559d
      Tetsuo Handa authored
      commit 71336e01 upstream.
      
      While ttm_dma_pool_shrink_scan() tries to take mutex before doing GFP_KERNEL
      allocation, ttm_pool_shrink_scan() does not do it. This can result in stack
      overflow if kmalloc() in ttm_page_pool_free() triggered recursion due to
      memory pressure.
      
        shrink_slab()
        => ttm_pool_shrink_scan()
           => ttm_page_pool_free()
              => kmalloc(GFP_KERNEL)
                 => shrink_slab()
                    => ttm_pool_shrink_scan()
                       => ttm_page_pool_free()
                          => kmalloc(GFP_KERNEL)
      
      Change ttm_pool_shrink_scan() to do like ttm_dma_pool_shrink_scan() does.
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - Change return value in the contended case to follow the old shrinker
         API]   
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      312b559d
    • Axel Lin's avatar
      hwmon: (sis5595) Prevent overflow problem when writing large limits · 0d362ea0
      Axel Lin authored
      commit cc336546 upstream.
      
      On platforms with sizeof(int) < sizeof(long), writing a temperature
      limit larger than MAXINT will result in unpredictable limit values
      written to the chip. Avoid auto-conversion from long to int to fix
      the problem.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0d362ea0
    • Axel Lin's avatar
      hwmon: (gpio-fan) Prevent overflow problem when writing large limits · 4623d221
      Axel Lin authored
      commit 2565fb05 upstream.
      
      On platforms with sizeof(int) < sizeof(unsigned long), writing a rpm value
      larger than MAXINT will result in unpredictable limit values written to the
      chip. Avoid auto-conversion from unsigned long to int to fix the problem.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4623d221
    • Clemens Ladisch's avatar
      ALSA: virtuoso: add Xonar Essence STX II support · 78c9a0e8
      Clemens Ladisch authored
      commit f42bb222 upstream.
      
      Just add the PCI ID for the STX II.  It appears to work the same as the
      STX, except for the addition of the not-yet-supported daughterboard.
      Tested-by: default avatarMario <fugazzi99@gmail.com>
      Tested-by: default avatarcorubba <corubba@gmx.de>
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      78c9a0e8
    • Sergiu Giurgiu's avatar
      ALSA: virtuoso: Xonar DSX support · 67cb6546
      Sergiu Giurgiu authored
      commit 44923632 upstream.
      
      This patch adds support for ASUS - Xonar DSX sound cards. Tested on
      openSUSE 12.2 with kernel:
      Linux 3.4.6-2.10-desktop #1 SMP PREEMPT Thu Jul 26 09:36:26 UTC 2012 (641c197) x86_64 x86_64 x86_64 GNU/Linux
      Works:
       - play sounds
       - adjust volume on master channel.
       - mute .
      
      Since Xonar DS uses the same chip, everything that works for DS should
      work for DSX as well.
      Signed-off-by: default avatarSergiu Giurgiu <sgiurgiu11@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      67cb6546
    • Patrick Riphagen's avatar
      USB: serial: ftdi_sio: Add support for new Xsens devices · 5547c8a6
      Patrick Riphagen authored
      commit 4bdcde35 upstream.
      
      This adds support for new Xsens devices, using Xsens' own Vendor ID.
      Signed-off-by: default avatarPatrick Riphagen <patrick.riphagen@xsens.com>
      Signed-off-by: default avatarFrans Klaver <frans.klaver@xsens.com>
      Cc: Johan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5547c8a6
    • Patrick Riphagen's avatar
      USB: serial: ftdi_sio: Annotate the current Xsens PID assignments · f1a1b8a2
      Patrick Riphagen authored
      commit 9273b8a2 upstream.
      
      The converters are used in specific products. It can be useful to know
      which they are exactly.
      Signed-off-by: default avatarPatrick Riphagen <patrick.riphagen@xsens.com>
      Signed-off-by: default avatarFrans Klaver <frans.klaver@xsens.com>
      Cc: Johan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f1a1b8a2
    • Paul Moore's avatar
      netlabel: fix a problem when setting bits below the previously lowest bit · 33401ce9
      Paul Moore authored
      commit 41c3bd20 upstream.
      
      The NetLabel category (catmap) functions have a problem in that they
      assume categories will be set in an increasing manner, e.g. the next
      category set will always be larger than the last.  Unfortunately, this
      is not a valid assumption and could result in problems when attempting
      to set categories less than the startbit in the lowest catmap node.
      In some cases kernel panics and other nasties can result.
      
      This patch corrects the problem by checking for this and allocating a
      new catmap node instance and placing it at the front of the list.
      Reported-by: default avatarChristian Evans <frodox@zoho.com>
      Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
      Tested-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      [bwh: Backported to 3.2: adjust filename for SMACK]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      33401ce9
    • Dan Carpenter's avatar
      netlabel: use GFP flags from caller instead of GFP_ATOMIC · 908964e5
      Dan Carpenter authored
      commit 64b5fad5 upstream.
      
      This function takes a GFP flags as a parameter, but they are never used.
      We don't take a lock in this function so there is no reason to prefer
      GFP_ATOMIC over the caller's GFP flags.
      
      There is only one caller, cipso_v4_map_cat_rng_ntoh(), and it passes
      GFP_ATOMIC as the GFP flags so this doesn't change how the code works.
      It's just a cleanup.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      908964e5
    • Jeremy Vial's avatar
      ARM: OMAP3: Fix choice of omap3_restore_es function in OMAP34XX rev3.1.2 case. · 8977e721
      Jeremy Vial authored
      commit 9b5f7428 upstream.
      
      According to the comment “restore_es3: applies to 34xx >= ES3.0" in
      "arch/arm/mach-omap2/sleep34xx.S”, omap3_restore_es3 should be used
      if the revision of an OMAP34xx is ES3.1.2.
      Signed-off-by: default avatarJeremy Vial <jvial@adeneo-embedded.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8977e721
    • Eric W. Biederman's avatar
      mnt: Change the default remount atime from relatime to the existing value · 24a26ff9
      Eric W. Biederman authored
      commit ffbc6f0e upstream.
      
      Since March 2009 the kernel has treated the state that if no
      MS_..ATIME flags are passed then the kernel defaults to relatime.
      
      Defaulting to relatime instead of the existing atime state during a
      remount is silly, and causes problems in practice for people who don't
      specify any MS_...ATIME flags and to get the default filesystem atime
      setting.  Those users may encounter a permission error because the
      default atime setting does not work.
      
      A default that does not work and causes permission problems is
      ridiculous, so preserve the existing value to have a default
      atime setting that is always guaranteed to work.
      
      Using the default atime setting in this way is particularly
      interesting for applications built to run in restricted userspace
      environments without /proc mounted, as the existing atime mount
      options of a filesystem can not be read from /proc/mounts.
      
      In practice this fixes user space that uses the default atime
      setting on remount that are broken by the permission checks
      keeping less privileged users from changing more privileged users
      atime settings.
      Acked-by: default avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      [bwh: Backported to 3.2: add definition of MNT_ATIME_MASK, as we don't
       need the fix that introduced that definition upstream]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      24a26ff9
    • Milan Broz's avatar
      crypto: af_alg - properly label AF_ALG socket · b446ad53
      Milan Broz authored
      commit 4c63f83c upstream.
      
      Th AF_ALG socket was missing a security label (e.g. SELinux)
      which means that socket was in "unlabeled" state.
      
      This was recently demonstrated in the cryptsetup package
      (cryptsetup v1.6.5 and later.)
      See https://bugzilla.redhat.com/show_bug.cgi?id=1115120
      
      This patch clones the sock's label from the parent sock
      and resolves the issue (similar to AF_BLUETOOTH protocol family).
      Signed-off-by: default avatarMilan Broz <gmazyland@gmail.com>
      Acked-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b446ad53
    • Jeffrey Deans's avatar
      MIPS: GIC: Prevent array overrun · 43b781e0
      Jeffrey Deans authored
      commit ffc8415a upstream.
      
      A GIC interrupt which is declared as having a GIC_MAP_TO_NMI_MSK
      mapping causes the cpu parameter to gic_setup_intr() to be increased
      to 32, causing memory corruption when pcpu_masks[] is written to again
      later in the function.
      Signed-off-by: default avatarJeffrey Deans <jeffrey.deans@imgtec.com>
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7375/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      43b781e0
    • Axel Lin's avatar
      hwmon: (amc6821) Fix possible race condition bug · 3e6d3af6
      Axel Lin authored
      commit cf44819c upstream.
      
      Ensure mutex lock protects the read-modify-write period to prevent possible
      race condition bug.
      In additional, update data->valid should also be protected by the mutex lock.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3e6d3af6
    • Sachin Kamat's avatar
      hwmon: (amc6821) Fix return value · 0719a7b8
      Sachin Kamat authored
      commit 3499e5b2 upstream.
      
      Propagate return value obtained from i2c_smbus_read_byte_data()
      instead of hardcoding.
      Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
      Cc: T. Mertelj <tomaz.mertelj@guest.arnes.si>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0719a7b8
    • Guenter Roeck's avatar
      hwmon: (lm78) Fix overflow problems seen when writing large temperature limits · 48371f90
      Guenter Roeck authored
      commit 1074d683 upstream.
      
      On platforms with sizeof(int) < sizeof(long), writing a temperature
      limit larger than MAXINT will result in unpredictable limit values
      written to the chip. Avoid auto-conversion from long to int to fix
      the problem.
      
      Cc: Axel Lin <axel.lin@ingics.com>
      Reviewed-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      48371f90
    • Guenter Roeck's avatar
      hwmon: (lm85) Fix various errors on attribute writes · d02ae215
      Guenter Roeck authored
      commit 3248c3b7 upstream.
      
      Temperature limit register writes did not account for negative numbers.
      As a result, writing -127000 resulted in -126000 written into the
      temperature limit register. This problem affected temp[1-3]_min,
      temp[1-3]_max, temp[1-3]_auto_temp_crit, and temp[1-3]_auto_temp_min.
      
      When writing pwm[1-3]_freq, a long variable was auto-converted into an int
      without range check. Wiring values larger than MAXINT resulted in unexpected
      register values.
      
      When writing temp[1-3]_auto_temp_max, an unsigned long variable was
      auto-converted into an int without range check. Writing values larger than
      MAXINT resulted in unexpected register values.
      
      vrm is an u8, so the written value needs to be limited to [0, 255].
      
      Cc: Axel Lin <axel.lin@ingics.com>
      Reviewed-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      [bwh: Backported to 3.2:
       - Driver is not using clamp_val(); keep using SENSORS_LIMIT() for consistency
       - Driver is not using kstrtoul(); make the minimum change to store_vrm_reg()
         so we can validate the value before assigning]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d02ae215
    • Theodore Ts'o's avatar
      ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa struct · 5024a6ef
      Theodore Ts'o authored
      commit 86f0afd4 upstream.
      
      If there is a failure while allocating the preallocation structure, a
      number of blocks can end up getting marked in the in-memory buddy
      bitmap, and then not getting released.  This can result in the
      following corruption getting reported by the kernel:
      
      EXT4-fs error (device sda3): ext4_mb_generate_buddy:758: group 1126,
      12793 clusters in bitmap, 12729 in gd
      
      In that case, we need to release the blocks using mb_free_blocks().
      
      Tested: fs smoke test; also demonstrated that with injected errors,
      	the file system is no longer getting corrupted
      
      Google-Bug-Id: 16657874
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5024a6ef
    • Zheng Liu's avatar
      ext4: cleanup in ext4_discard_allocated_blocks() · 6f98bebd
      Zheng Liu authored
      commit 400db9d3 upstream.
      
      remove 'len' variable in ext4_discard_allocated_blocks() because it is
      useless.
      Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6f98bebd
    • NeilBrown's avatar
      md/raid1,raid10: always abort recover on write error. · 9a28f9e6
      NeilBrown authored
      commit 2446dba0 upstream.
      
      Currently we don't abort recovery on a write error if the write error
      to the recovering device was triggerd by normal IO (as opposed to
      recovery IO).
      
      This means that for one bitmap region, the recovery might write to the
      recovering device for a few sectors, then not bother for subsequent
      sectors (as it never writes to failed devices).  In this case
      the bitmap bit will be cleared, but it really shouldn't.
      
      The result is that if the recovering device fails and is then re-added
      (after fixing whatever hardware problem triggerred the failure),
      the second recovery won't redo the region it was in the middle of,
      so some of the device will not be recovered properly.
      
      If we abort the recovery, the region being processes will be cancelled
      (bit not cleared) and the whole region will be retried.
      
      As the bug can result in data corruption the patch is suitable for
      -stable.  For kernels prior to 3.11 there is a conflict in raid10.c
      which will require care.
      
      Original-from: jiao hui <jiaohui@bwstor.com.cn>
      Reported-and-tested-by: default avatarjiao hui <jiaohui@bwstor.com.cn>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9a28f9e6
    • David Rientjes's avatar
      mm, thp: do not allow thp faults to avoid cpuset restrictions · 74eb879f
      David Rientjes authored
      commit b104a35d upstream.
      
      The page allocator relies on __GFP_WAIT to determine if ALLOC_CPUSET
      should be set in allocflags.  ALLOC_CPUSET controls if a page allocation
      should be restricted only to the set of allowed cpuset mems.
      
      Transparent hugepages clears __GFP_WAIT when defrag is disabled to prevent
      the fault path from using memory compaction or direct reclaim.  Thus, it
      is unfairly able to allocate outside of its cpuset mems restriction as a
      side-effect.
      
      This patch ensures that ALLOC_CPUSET is only cleared when the gfp mask is
      truly GFP_ATOMIC by verifying it is also not a thp allocation.
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Reported-by: default avatarAlex Thorlton <athorlton@sgi.com>
      Tested-by: default avatarAlex Thorlton <athorlton@sgi.com>
      Cc: Bob Liu <lliubbo@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Hedi Berriche <hedi@sgi.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Srivatsa S. Bhat <srivatsa.bhat@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>
      74eb879f