1. 10 Apr, 2013 24 commits
  2. 27 Mar, 2013 16 commits
    • Ben Hutchings's avatar
      Linux 3.2.42 · d27ba550
      Ben Hutchings authored
      d27ba550
    • Andrew Morton's avatar
      kernel/signal.c: use __ARCH_HAS_SA_RESTORER instead of SA_RESTORER · b6c424a7
      Andrew Morton authored
      commit 522cff14 upstream.
      
      __ARCH_HAS_SA_RESTORER is the preferred conditional for use in 3.9 and
      later kernels, per Kees.
      
      Cc: Emese Revfy <re.emese@gmail.com>
      Cc: Emese Revfy <re.emese@gmail.com>
      Cc: PaX Team <pageexec@freemail.hu>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Serge Hallyn <serge.hallyn@canonical.com>
      Cc: Julien Tinnes <jln@google.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>
      b6c424a7
    • Ben Hutchings's avatar
      signal: Define __ARCH_HAS_SA_RESTORER so we know whether to clear sa_restorer · b170d219
      Ben Hutchings authored
      flush_signal_handlers() needs to know whether sigaction::sa_restorer
      is defined, not whether SA_RESTORER is defined.  Define the
      __ARCH_HAS_SA_RESTORER macro to indicate this.
      
      Vaguely based on upstream commit 574c4866 'consolidate kernel-side
      struct sigaction declarations'.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      b170d219
    • Ben Hutchings's avatar
      efivars: pstore: Do not check size when erasing variable · 80a19deb
      Ben Hutchings authored
      In 3.2, unlike mainline, efi_pstore_erase() calls efi_pstore_write()
      with a size of 0, as the underlying EFI interface treats a size of 0
      as meaning deletion.
      
      This was not taken into account in my backport of commit d80a361d
      'efi_pstore: Check remaining space with QueryVariableInfo() before
      writing data'.  The size check should be omitted when erasing.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      80a19deb
    • Torsten Duwe's avatar
      KMS: fix EDID detailed timing frame rate · b5393b0f
      Torsten Duwe authored
      commit c19b3b0f upstream.
      
      When KMS has parsed an EDID "detailed timing", it leaves the frame rate
      zeroed.  Consecutive (debug-) output of that mode thus yields 0 for
      vsync.  This simple fix also speeds up future invocations of
      drm_mode_vrefresh().
      
      While it is debatable whether this qualifies as a -stable fix I'd apply
      it for consistency's sake; drm_helper_probe_single_connector_modes()
      does the same thing already for all probed modes.
      Signed-off-by: default avatarTorsten Duwe <duwe@lst.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b5393b0f
    • Torsten Duwe's avatar
      KMS: fix EDID detailed timing vsync parsing · 1b5ee14a
      Torsten Duwe authored
      commit 16dad1d7 upstream.
      
      EDID spreads some values across multiple bytes; bit-fiddling is needed
      to retrieve these.  The current code to parse "detailed timings" has a
      cut&paste error that results in a vsync offset of at most 15 lines
      instead of 63.
      
      See
      
         http://en.wikipedia.org/wiki/EDID
      
      and in the "EDID Detailed Timing Descriptor" see bytes 10+11 show why
      that needs to be a left shift.
      Signed-off-by: default avatarTorsten Duwe <duwe@lst.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1b5ee14a
    • Wanpeng Li's avatar
      mm/hugetlb: fix total hugetlbfs pages count when using memory overcommit accouting · e58c0a52
      Wanpeng Li authored
      commit d0028588 upstream.
      
      hugetlb_total_pages is used for overcommit calculations but the current
      implementation considers only the default hugetlb page size (which is
      either the first defined hugepage size or the one specified by
      default_hugepagesz kernel boot parameter).
      
      If the system is configured for more than one hugepage size, which is
      possible since commit a137e1cc ("hugetlbfs: per mount huge page
      sizes") then the overcommit estimation done by __vm_enough_memory()
      (resp.  shown by meminfo_proc_show) is not precise - there is an
      impression of more available/allowed memory.  This can lead to an
      unexpected ENOMEM/EFAULT resp.  SIGSEGV when memory is accounted.
      
      Testcase:
        boot: hugepagesz=1G hugepages=1
        the default overcommit ratio is 50
        before patch:
      
          egrep 'CommitLimit' /proc/meminfo
          CommitLimit:     55434168 kB
      
        after patch:
      
          egrep 'CommitLimit' /proc/meminfo
          CommitLimit:     54909880 kB
      
      [akpm@linux-foundation.org: coding-style tweak]
      Signed-off-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Hillf Danton <dhillf@gmail.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.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>
      e58c0a52
    • Linus Torvalds's avatar
      vfs,proc: guarantee unique inodes in /proc · 4c239ba6
      Linus Torvalds authored
      commit 51f0885e upstream.
      
      Dave Jones found another /proc issue with his Trinity tool: thanks to
      the namespace model, we can have multiple /proc dentries that point to
      the same inode, aliasing directories in /proc/<pid>/net/ for example.
      
      This ends up being a total disaster, because it acts like hardlinked
      directories, and causes locking problems.  We rely on the topological
      sort of the inodes pointed to by dentries, and if we have aliased
      directories, that odering becomes unreliable.
      
      In short: don't do this.  Multiple dentries with the same (directory)
      inode is just a bad idea, and the namespace code should never have
      exposed things this way.  But we're kind of stuck with it.
      
      This solves things by just always allocating a new inode during /proc
      dentry lookup, instead of using "iget_locked()" to look up existing
      inodes by superblock and number.  That actually simplies the code a bit,
      at the cost of potentially doing more inode [de]allocations.
      
      That said, the inode lookup wasn't free either (and did a lot of locking
      of inodes), so it is probably not that noticeable.  We could easily keep
      the old lookup model for non-directory entries, but rather than try to
      be excessively clever this just implements the minimal and simplest
      workaround for the problem.
      Reported-and-tested-by: default avatarDave Jones <davej@redhat.com>
      Analyzed-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - Never drop the pde reference in proc_get_inode(), as callers only
         expect this when we return an existing inode, and we never do that now]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4c239ba6
    • Laxman Dewangan's avatar
      i2c: tegra: check the clk_prepare_enable() return value · e52ca260
      Laxman Dewangan authored
      commit 132c803f upstream.
      
      NVIDIA's Tegra SoC allows read/write of controller register only
      if controller clock is enabled. System hangs if read/write happens
      to registers without enabling clock.
      
      clk_prepare_enable() can be fail due to unknown reason and hence
      adding check for return value of this function. If this function
      success then only access register otherwise return to caller with
      error.
      Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
      Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      [bwh: Backported to 3.2:
       - Adjust context
       - Keep calling clk_enable() directly]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e52ca260
    • Johan Hovold's avatar
      USB: serial: fix interface refcounting · 033aa840
      Johan Hovold authored
      commit d7971051 upstream.
      
      Make sure the interface is not released before our serial device.
      
      Note that drivers are still not allowed to access the interface in
      any way that may interfere with another driver that may have gotten
      bound to the same interface after disconnect returns.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      033aa840
    • Johan Hovold's avatar
      USB: io_ti: fix get_icount for two port adapters · 06b72f04
      Johan Hovold authored
      commit 5492bf3d upstream.
      
      Add missing get_icount field to two-port driver.
      
      The two-port driver was not updated when switching to the new icount
      interface in commit 0bca1b91 ("tty: Convert the USB drivers to the
      new icount interface").
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      06b72f04
    • Johan Hovold's avatar
      USB: garmin_gps: fix memory leak on disconnect · 6092e4b9
      Johan Hovold authored
      commit 618aa106 upstream.
      
      Remove bogus disconnect test introduced by 95bef012 ("USB: more serial
      drivers writing after disconnect") which prevented queued data from
      being freed on disconnect.
      
      The possible IO it was supposed to prevent is long gone.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6092e4b9
    • Jeff Layton's avatar
      cifs: ignore everything in SPNEGO blob after mechTypes · bbb8c223
      Jeff Layton authored
      commit f853c616 upstream.
      
      We've had several reports of people attempting to mount Windows 8 shares
      and getting failures with a return code of -EINVAL. The default sec=
      mode changed recently to sec=ntlmssp. With that, we expect and parse a
      SPNEGO blob from the server in the NEGOTIATE reply.
      
      The current decode_negTokenInit function first parses all of the
      mechTypes and then tries to parse the rest of the negTokenInit reply.
      The parser however currently expects a mechListMIC or nothing to follow the
      mechTypes, but Windows 8 puts a mechToken field there instead to carry
      some info for the new NegoEx stuff.
      
      In practice, we don't do anything with the fields after the mechTypes
      anyway so I don't see any real benefit in continuing to parse them.
      This patch just has the kernel ignore the fields after the mechTypes.
      We'll probably need to reinstate some of this if we ever want to support
      NegoEx.
      Reported-by: default avatarJason Burgess <jason@jacknife2.dns2go.com>
      Reported-by: default avatarYan Li <elliot.li.tech@gmail.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bbb8c223
    • Matt Fleming's avatar
      efivars: Handle duplicate names from get_next_variable() · b1576b45
      Matt Fleming authored
      commit e971318b upstream.
      
      Some firmware exhibits a bug where the same VariableName and
      VendorGuid values are returned on multiple invocations of
      GetNextVariableName(). See,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47631
      
      As a consequence of such a bug, Andre reports hitting the following
      WARN_ON() in the sysfs code after updating the BIOS on his, "Gigabyte
      Technology Co., Ltd. To be filled by O.E.M./Z77X-UD3H, BIOS F19e
      11/21/2012)" machine,
      
      [    0.581554] EFI Variables Facility v0.08 2004-May-17
      [    0.584914] ------------[ cut here ]------------
      [    0.585639] WARNING: at /home/andre/linux/fs/sysfs/dir.c:536 sysfs_add_one+0xd4/0x100()
      [    0.586381] Hardware name: To be filled by O.E.M.
      [    0.587123] sysfs: cannot create duplicate filename '/firmware/efi/vars/SbAslBufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8'
      [    0.588694] Modules linked in:
      [    0.589484] Pid: 1, comm: swapper/0 Not tainted 3.8.0+ #7
      [    0.590280] Call Trace:
      [    0.591066]  [<ffffffff81208954>] ? sysfs_add_one+0xd4/0x100
      [    0.591861]  [<ffffffff810587bf>] warn_slowpath_common+0x7f/0xc0
      [    0.592650]  [<ffffffff810588bc>] warn_slowpath_fmt+0x4c/0x50
      [    0.593429]  [<ffffffff8134dd85>] ? strlcat+0x65/0x80
      [    0.594203]  [<ffffffff81208954>] sysfs_add_one+0xd4/0x100
      [    0.594979]  [<ffffffff81208b78>] create_dir+0x78/0xd0
      [    0.595753]  [<ffffffff81208ec6>] sysfs_create_dir+0x86/0xe0
      [    0.596532]  [<ffffffff81347e4c>] kobject_add_internal+0x9c/0x220
      [    0.597310]  [<ffffffff81348307>] kobject_init_and_add+0x67/0x90
      [    0.598083]  [<ffffffff81584a71>] ? efivar_create_sysfs_entry+0x61/0x1c0
      [    0.598859]  [<ffffffff81584b2b>] efivar_create_sysfs_entry+0x11b/0x1c0
      [    0.599631]  [<ffffffff8158517e>] register_efivars+0xde/0x420
      [    0.600395]  [<ffffffff81d430a7>] ? edd_init+0x2f5/0x2f5
      [    0.601150]  [<ffffffff81d4315f>] efivars_init+0xb8/0x104
      [    0.601903]  [<ffffffff8100215a>] do_one_initcall+0x12a/0x180
      [    0.602659]  [<ffffffff81d05d80>] kernel_init_freeable+0x13e/0x1c6
      [    0.603418]  [<ffffffff81d05586>] ? loglevel+0x31/0x31
      [    0.604183]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
      [    0.604936]  [<ffffffff816a653e>] kernel_init+0xe/0xf0
      [    0.605681]  [<ffffffff816ce7ec>] ret_from_fork+0x7c/0xb0
      [    0.606414]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
      [    0.607143] ---[ end trace 1609741ab737eb29 ]---
      
      There's not much we can do to work around and keep traversing the
      variable list once we hit this firmware bug. Our only solution is to
      terminate the loop because, as Lingzhu reports, some machines get
      stuck when they encounter duplicate names,
      
        > I had an IBM System x3100 M4 and x3850 X5 on which kernel would
        > get stuck in infinite loop creating duplicate sysfs files because,
        > for some reason, there are several duplicate boot entries in nvram
        > getting GetNextVariableName into a circle of iteration (with
        > period > 2).
      
      Also disable the workqueue, as efivar_update_sysfs_entries() uses
      GetNextVariableName() to figure out which variables have been created
      since the last iteration. That algorithm isn't going to work if
      GetNextVariableName() returns duplicates. Note that we don't disable
      EFI variable creation completely on the affected machines, it's just
      that any pstore dump-* files won't appear in sysfs until the next
      boot.
      Reported-by: default avatarAndre Heider <a.heider@gmail.com>
      Reported-by: default avatarLingzhu Xiang <lxiang@redhat.com>
      Tested-by: default avatarLingzhu Xiang <lxiang@redhat.com>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      [bwh: Backported to 3.2: reason is not checked in efi_pstore_write()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b1576b45
    • Matt Fleming's avatar
      efivars: explicitly calculate length of VariableName · fe73a5eb
      Matt Fleming authored
      commit ec50bd32 upstream.
      
      It's not wise to assume VariableNameSize represents the length of
      VariableName, as not all firmware updates VariableNameSize in the same
      way (some don't update it at all if EFI_SUCCESS is returned). There
      are even implementations out there that update VariableNameSize with
      values that are both larger than the string returned in VariableName
      and smaller than the buffer passed to GetNextVariableName(), which
      resulted in the following bug report from Michael Schroeder,
      
        > On HP z220 system (firmware version 1.54), some EFI variables are
        > incorrectly named :
        >
        > ls -d /sys/firmware/efi/vars/*8be4d* | grep -v -- -8be returns
        > /sys/firmware/efi/vars/dbxDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/KEKDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/SecureBoot-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/SetupMode-Information8be4df61-93ca-11d2-aa0d-00e098032b8c
      
      The issue here is that because we blindly use VariableNameSize without
      verifying its value, we can potentially read garbage values from the
      buffer containing VariableName if VariableNameSize is larger than the
      length of VariableName.
      
      Since VariableName is a string, we can calculate its size by searching
      for the terminating NULL character.
      Reported-by: default avatarFrederic Crozat <fcrozat@suse.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Cc: Michael Schroeder <mls@suse.com>
      Cc: Lee, Chun-Yi <jlee@suse.com>
      Cc: Lingzhu Xiang <lxiang@redhat.com>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      fe73a5eb
    • Seiji Aguchi's avatar
      efi_pstore: Introducing workqueue updating sysfs · adddb409
      Seiji Aguchi authored
      commit a93bc0c6 upstream.
      
      [Problem]
      efi_pstore creates sysfs entries, which enable users to access to NVRAM,
      in a write callback. If a kernel panic happens in an interrupt context,
      it may fail because it could sleep due to dynamic memory allocations during
      creating sysfs entries.
      
      [Patch Description]
      This patch removes sysfs operations from a write callback by introducing
      a workqueue updating sysfs entries which is scheduled after the write
      callback is called.
      
      Also, the workqueue is kicked in a just oops case.
      A system will go down in other cases such as panic, clean shutdown and emergency
      restart. And we don't need to create sysfs entries because there is no chance for
      users to access to them.
      
      efi_pstore will be robust against a kernel panic in an interrupt context with this patch.
      Signed-off-by: default avatarSeiji Aguchi <seiji.aguchi@hds.com>
      Acked-by: default avatarMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      [bwh: Backported to 3.2:
       - Adjust contest
       - Don't check reason in efi_pstore_write(), as it is not given as a
         parameter
       - Move up declaration of __efivars]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      adddb409