1. 16 Jan, 2013 10 commits
    • Hugh Dickins's avatar
      tmpfs mempolicy: fix /proc/mounts corrupting memory · b8709f81
      Hugh Dickins authored
      commit f2a07f40 upstream.
      
      Recently I suggested using "mount -o remount,mpol=local /tmp" in NUMA
      mempolicy testing.  Very nasty.  Reading /proc/mounts, /proc/pid/mounts
      or /proc/pid/mountinfo may then corrupt one bit of kernel memory, often
      in a page table (causing "Bad swap" or "Bad page map" warning or "Bad
      pagetable" oops), sometimes in a vm_area_struct or rbnode or somewhere
      worse.  "mpol=prefer" and "mpol=prefer:Node" are equally toxic.
      
      Recent NUMA enhancements are not to blame: this dates back to 2.6.35,
      when commit e17f74af "mempolicy: don't call mpol_set_nodemask() when
      no_context" skipped mpol_parse_str()'s call to mpol_set_nodemask(),
      which used to initialize v.preferred_node, or set MPOL_F_LOCAL in flags.
      With slab poisoning, you can then rely on mpol_to_str() to set the bit
      for node 0x6b6b, probably in the next page above the caller's stack.
      
      mpol_parse_str() is only called from shmem_parse_options(): no_context
      is always true, so call it unused for now, and remove !no_context code.
      Set v.nodes or v.preferred_node or MPOL_F_LOCAL as mpol_to_str() might
      expect.  Then mpol_to_str() can ignore its no_context argument also,
      the mpol being appropriately initialized whether contextualized or not.
      Rename its no_context unused too, and let subsequent patch remove them
      (that's not needed for stable backporting, which would involve rejects).
      
      I don't understand why MPOL_LOCAL is described as a pseudo-policy:
      it's a reasonable policy which suffers from a confusing implementation
      in terms of MPOL_PREFERRED with MPOL_F_LOCAL.  I believe this would be
      much more robust if MPOL_LOCAL were recognized in switch statements
      throughout, MPOL_F_LOCAL deleted, and MPOL_PREFERRED use the (possibly
      empty) nodes mask like everyone else, instead of its preferred_node
      variant (I presume an optimization from the days before MPOL_LOCAL).
      But that would take me too long to get right and fully tested.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b8709f81
    • Jeff Layton's avatar
      cifs: adjust sequence number downward after signing NT_CANCEL request · f6f82cba
      Jeff Layton authored
      commit 31efee60 upstream.
      
      When a call goes out, the signing code adjusts the sequence number
      upward by two to account for the request and the response. An NT_CANCEL
      however doesn't get a response of its own, it just hurries the server
      along to get it to respond to the original request more quickly.
      Therefore, we must adjust the sequence number back down by one after
      signing a NT_CANCEL request.
      Reported-by: default avatarTim Perry <tdparmor-sambabugs@yahoo.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f6f82cba
    • Christoffer Dall's avatar
      mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED · c41fba2f
      Christoffer Dall authored
      commit ad4b3fb7 upstream.
      
      Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and
      (PageHead) is true, for tail pages.  If this is indeed the intended
      behavior, which I doubt because it breaks cache cleaning on some ARM
      systems, then the nomenclature is highly problematic.
      
      This patch makes sure PageHead is only true for head pages and PageTail
      is only true for tail pages, and neither is true for non-compound pages.
      
      [ This buglet seems ancient - seems to have been introduced back in Apr
        2008 in commit 6a1e7f77: "pageflags: convert to the use of new
        macros".  And the reason nobody noticed is because the PageHead()
        tests are almost all about just sanity-checking, and only used on
        pages that are actual page heads.  The fact that the old code returned
        true for tail pages too was thus not really noticeable.   - Linus ]
      Signed-off-by: default avatarChristoffer Dall <cdall@cs.columbia.edu>
      Acked-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Will Deacon <Will.Deacon@arm.com>
      Cc: Steve Capper <Steve.Capper@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c41fba2f
    • Andy Lutomirski's avatar
      PCI: Reduce Ricoh 0xe822 SD card reader base clock frequency to 50MHz · fb7e3f10
      Andy Lutomirski authored
      commit 812089e0 upstream.
      
      Otherwise it fails like this on cards like the Transcend 16GB SDHC card:
      
          mmc0: new SDHC card at address b368
          mmcblk0: mmc0:b368 SDC   15.0 GiB
          mmcblk0: error -110 sending status command, retrying
          mmcblk0: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb0
      
      Tested on my Lenovo x200 laptop.
      
      [bhelgaas: changelog]
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarChris Ball <cjb@laptop.org>
      CC: Manoj Iyer <manoj.iyer@canonical.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      fb7e3f10
    • Michael Tokarev's avatar
      ext4: do not try to write superblock on ro remount w/o journal · ad74aa67
      Michael Tokarev authored
      commit d096ad0f upstream.
      
      When a journal-less ext4 filesystem is mounted on a read-only block
      device (blockdev --setro will do), each remount (for other, unrelated,
      flags, like suid=>nosuid etc) results in a series of scary messages
      from kernel telling about I/O errors on the device.
      
      This is becauese of the following code ext4_remount():
      
             if (sbi->s_journal == NULL)
                      ext4_commit_super(sb, 1);
      
      at the end of remount procedure, which forces writing (flushing) of
      a superblock regardless whenever it is dirty or not, if the filesystem
      is readonly or not, and whenever the device itself is readonly or not.
      
      We only need call ext4_commit_super when the file system had been
      previously mounted read/write.
      
      Thanks to Eric Sandeen for help in diagnosing this issue.
      Signed-off-By: default avatarMichael Tokarev <mjt@tls.msk.ru>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ad74aa67
    • Chris Verges's avatar
      hwmon: (lm73} Detect and report i2c bus errors · c53ed31e
      Chris Verges authored
      commit 0602934f upstream.
      
      If an LM73 device does not exist on an I2C bus, attempts to communicate
      with the device result in an error code returned from the i2c read/write
      functions.  The current lm73 driver casts that return value from a s32
      type to a s16 type, then converts it to a temperature in celsius.
      Because negative temperatures are valid, it is difficult to distinguish
      between an error code printed to the response buffer and a negative
      temperature recorded by the sensor.
      
      The solution is to evaluate the return value from the i2c functions
      before performing any temperature calculations.  If the i2c function did
      not succeed, the error code should be passed back through the virtual
      file system layer instead of being printed into the response buffer.
      
      Before:
      
         $ cat /sys/class/hwmon/hwmon0/device/temp1_input
         -46
      
      After:
      
         $ cat /sys/class/hwmon/hwmon0/device/temp1_input
         cat: read error: No such device or address
      Signed-off-by: default avatarChris Verges <kg4ysn@gmail.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c53ed31e
    • Jan Kara's avatar
      jbd2: fix assertion failure in jbd2_journal_flush() · 7a552832
      Jan Kara authored
      commit d7961c7f upstream.
      
      The following race is possible between start_this_handle() and someone
      calling jbd2_journal_flush().
      
      Process A                              Process B
      start_this_handle().
        if (journal->j_barrier_count) # false
        if (!journal->j_running_transaction) { #true
          read_unlock(&journal->j_state_lock);
                                             jbd2_journal_lock_updates()
                                             jbd2_journal_flush()
                                               write_lock(&journal->j_state_lock);
                                               if (journal->j_running_transaction) {
                                                 # false
                                               ... wait for committing trans ...
                                               write_unlock(&journal->j_state_lock);
          ...
          write_lock(&journal->j_state_lock);
          if (!journal->j_running_transaction) { # true
            jbd2_get_transaction(journal, new_transaction);
          write_unlock(&journal->j_state_lock);
          goto repeat; # eventually blocks on j_barrier_count > 0
                                               ...
                                               J_ASSERT(!journal->j_running_transaction);
                                                 # fails
      
      We fix the race by rechecking j_barrier_count after reacquiring j_state_lock
      in exclusive mode.
      
      Reported-by: yjwsignal@empal.com
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7a552832
    • Jan Kara's avatar
      ext4: check dioread_nolock on remount · f21cf73c
      Jan Kara authored
      commit 261cb20c upstream.
      
      Currently we allow enabling dioread_nolock mount option on remount for
      filesystems where blocksize < PAGE_CACHE_SIZE.  This isn't really
      supported so fix the bug by moving the check for blocksize !=
      PAGE_CACHE_SIZE into parse_options(). Change the original PAGE_SIZE to
      PAGE_CACHE_SIZE along the way because that's what we are really
      interested in.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f21cf73c
    • Krzysztof Mazur's avatar
      i915: ensure that VGA plane is disabled · 29abfe4d
      Krzysztof Mazur authored
      commit 0fde901f upstream.
      
      Some broken systems (like HP nc6120) in some cases, usually after LID
      close/open, enable VGA plane, making display unusable (black screen on LVDS,
      some strange mode on VGA output). We used to disable VGA plane only once at
      startup. Now we also check, if VGA plane is still disabled while changing
      mode, and fix that if something changed it.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57434Signed-off-by: default avatarKrzysztof Mazur <krzysiek@podlesie.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      [bwh: Backported to 3.2: intel_modeset_setup_hw_state() does not
       exist, so call i915_redisable_vga() directly from intel_lid_notify()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      29abfe4d
    • Forrest Liu's avatar
      ext4: fix extent tree corruption caused by hole punch · f7967624
      Forrest Liu authored
      commit c36575e6 upstream.
      
      When depth of extent tree is greater than 1, logical start value of
      interior node is not correctly updated in ext4_ext_rm_idx.
      Signed-off-by: default avatarForrest Liu <forrestl@synology.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarAshish Sangwan <ashishsangwan2@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f7967624
  2. 03 Jan, 2013 30 commits