Skip to content
  1. Apr 24, 2011
  2. Apr 23, 2011
  3. Apr 22, 2011
  4. Apr 21, 2011
    • Jan Kara's avatar
      vfs: Pass setxattr(2) flags properly · df7e1303
      Jan Kara authored
      
      
      For some reason generic_setxattr() did not pass flags (XATTR_CREATE,
      XATTR_REPLACE) to the filesystem specific helper. This caused that
      setxattr(2) syscall just ignored these flags.
      
      Fix the bug by passing flags correctly.
      
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Acked-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df7e1303
    • Amit Shah's avatar
      virtio: console: Enable call to hvc_remove() on console port remove · afa2689e
      Amit Shah authored
      
      
      This call was disabled as hot-unplugging one virtconsole port led to
      another virtconsole port freezing.
      
      Upon testing it again, this now works, so enable it.
      
      In addition, a bug was found in qemu wherein removing a port of one type
      caused the guest output from another port to stop working.  I doubt it
      was just this bug that caused it (since disabling the hvc_remove() call
      did allow other ports to continue working), but since it's all solved
      now, we're fine with hot-unplugging of virtconsole ports.
      
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      afa2689e
    • Amit Shah's avatar
      virtio_pci: Prevent double-free of pci regions after device hot-unplug · 31a3ddda
      Amit Shah authored
      
      
      In the case where a virtio-console port is in use (opened by a program)
      and a virtio-console device is removed, the port is kept around but all
      the virtio-related state is assumed to be gone.
      
      When the port is finally released (close() called), we call
      device_destroy() on the port's device.  This results in the parent
      device's structures to be freed as well.  This includes the PCI regions
      for the virtio-console PCI device.
      
      Once this is done, however, virtio_pci_release_dev() kicks in, as the
      last ref to the virtio device is now gone, and attempts to do
      
           pci_iounmap(pci_dev, vp_dev->ioaddr);
           pci_release_regions(pci_dev);
           pci_disable_device(pci_dev);
      
      which results in a double-free warning.
      
      Move the code that releases regions, etc., to the virtio_pci_remove()
      function, and all that's now left in release_dev is the final freeing of
      the vp_dev.
      
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      31a3ddda
    • Amit Shah's avatar
      virtio: Decrement avail idx on buffer detach · b3258ff1
      Amit Shah authored
      
      
      When detaching a buffer from a vq, the avail.idx value should be
      decremented as well.
      
      This was noticed by hot-unplugging a virtio console port and then
      plugging in a new one on the same number (re-using the vqs which were
      just 'disowned').  qemu reported
      
         'Guest moved used index from 0 to 256'
      
      when any IO was attempted on the new port.
      
      CC: stable@kernel.org
      Reported-by: default avatarjuzhang <juzhang@redhat.com>
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      b3258ff1
    • Joseph Cihula's avatar
      intel_iommu: disable all VT-d PMRs when TXT launched · 51a63e67
      Joseph Cihula authored
      
      
      Intel VT-d Protected Memory Regions (PMRs) are supposed to be disabled,
      on each VT-d engine, after DMA remapping is enabled on the engines.
      This is because the behavior of having both enabled is not deterministic
      and because, if TXT has been used to launch the kernel, the PMRs may be
      programmed to cover memory regions that will be used for DMA.
      
      Under some circumstances (certain quirks detected, lack of multiple
      devices, etc.), the current code does not set up DMA remapping on some
      VT-d engines.  In such cases it also skips disabling the PMRs.  This
      causes failures when the kernel is launched with TXT (most often this
      occurs on the graphics engine and results in colored vertical bars on
      the display).
      
      This patch detects when the kernel has been launched with TXT and then
      disables the PMRs on all VT-d engines.  In some cases where the reason
      that remapping is not being enabled is due to possible ACPI DMAR table
      errors, the VT-d engine addresses may not be correct and thus not able
      to be safely programmed even to disable PMRs.  Because part of the TXT
      launch process is the verification of these addresses, it will always be
      safe to disable PMRs if the TXT launch has succeeded and hence only
      doing this in such cases.
      
      Signed-off-by: default avatarJoseph Cihula <joseph.cihula@intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      51a63e67
    • Artem Bityutskiy's avatar
      UBIFS: fix master node recovery · 6e0d9fd3
      Artem Bityutskiy authored
      
      
      This patch fixes the following symptoms:
      1. Unmount UBIFS cleanly.
      2. Start mounting UBIFS R/W and have a power cut immediately
      3. Start mounting UBIFS R/O, this succeeds
      4. Try to re-mount UBIFS R/W - this fails immediately or later on,
         because UBIFS will write the master node to the flash area
         which has been written before.
      
      The analysis of the problem:
      
      1. UBIFS is unmounted cleanly, both copies of the master node are clean.
      2. UBIFS is being mounter R/W, starts changing master node copy 1, and
         a power cut happens. The copy N1 becomes corrupted.
      3. UBIFS is being mounted R/O. It notices the copy N1 is corrupted and
         reads copy N2. Copy N2 is clean.
      4. Because of R/O mode, UBIFS cannot recover copy 1.
      5. The mount code (ubifs_mount()) sees that the master node is clean,
         so it decides that no recovery is needed.
      6. We are re-mounting R/W. UBIFS believes no recovery is needed and
         starts updating the master node, but copy N1 is still corrupted
         and was not recovered!
      
      Fix this problem by marking the master node as dirty every time we
      recover it and we are in R/O mode. This forces further recovery and
      the UBIFS cleans-up the corruptions and recovers the copy N1 when
      re-mounting R/W later.
      
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      6e0d9fd3
    • Artem Bityutskiy's avatar
      UBIFS: fix false assertion warning in case of I/O failures · 1a067a22
      Artem Bityutskiy authored
      
      
      When UBIFS switches to R/O mode because it detects I/O failures, then
      when we unmount, we still may have allocated budget, and the assertions
      which verify that we have not budget will fire. But it is expected to
      have the budget in case of I/O failures, so the assertion warnings will
      be false. Suppress them for the I/O failure case.
      
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1a067a22
    • Takashi Iwai's avatar
      Merge branch 'fix/hda' into for-linus · 6a9a6f23
      Takashi Iwai authored
      6a9a6f23
    • David Rientjes's avatar
      x86, numa: Fix cpu nodemasks for NUMA emulation and CONFIG_DEBUG_PER_CPU_MAPS · 7a6c6547
      David Rientjes authored
      
      
      The cpu<->node mappings under CONFIG_DEBUG_PER_CPU_MAPS=y
      when NUMA emulation is enabled is currently broken because it does
      not iterate through every emulated node and bind cpus that have
      affinity to it.
      
      NUMA emulation should bind each cpu to every local node to
      accurately represent the true NUMA topology of the underlying
      machine.
      
      debug_cpumask_set_cpu() needs to be fixed at the same time so
      that the debugging information that it emits shows the new
      cpumask of the node being assigned when the cpu is being added
      or removed.
      
      It can now take responsibility of setting or clearing the cpu
      itself to remove the need for duplicate code.
      
      Also change its last parameter, "enable", to have the correct bool
      type since it can only be true or false.
      
       -v2: Fix the return statements, by Kosaki Motohiro
      
      Acked-and-Tested-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1104201918470.12634@chino.kir.corp.google.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7a6c6547
    • David Rientjes's avatar
      Revert "x86, NUMA: Fix fakenuma boot failure" · 37f8527d
      David Rientjes authored
      Andreas Herrmann reported that 7d6b4670
      
       ("x86, NUMA: Fix fakenuma
      boot failure") causes certain physical NUMA topologies (for example
      AMD Magny-Cours) to move sibling cpus to a single node when in reality
      they are in separate domains.
      
      This may result in some nodes being completely void of cpus, which
      doesn't accurately represent the correct topology. The system will
      boot, but will have suboptimal NUMA performance.
      
      This commit was intended as a fix for NUMA emulation, but should
      not cause a regression for real NUMA machines as a side effect.
      
      ( There will be a separate fix for the numa-debug code, which
        will not affect physical topologies. )
      
      Reported-by: default avatarAndreas Herrmann <herrmann.der.user@googlemail.com>
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1104201918110.12634@chino.kir.corp.google.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      37f8527d
    • Vasiliy Kulikov's avatar
      agp: fix arbitrary kernel memory writes · 194b3da8
      Vasiliy Kulikov authored
      
      
      pg_start is copied from userspace on AGPIOC_BIND and AGPIOC_UNBIND ioctl
      cmds of agp_ioctl() and passed to agpioc_bind_wrap().  As said in the
      comment, (pg_start + mem->page_count) may wrap in case of AGPIOC_BIND,
      and it is not checked at all in case of AGPIOC_UNBIND.  As a result, user
      with sufficient privileges (usually "video" group) may generate either
      local DoS or privilege escalation.
      
      Signed-off-by: default avatarVasiliy Kulikov <segoon@openwall.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      194b3da8
    • Vasiliy Kulikov's avatar
      agp: fix OOM and buffer overflow · b522f021
      Vasiliy Kulikov authored
      
      
      page_count is copied from userspace.  agp_allocate_memory() tries to
      check whether this number is too big, but doesn't take into account the
      wrap case.  Also agp_create_user_memory() doesn't check whether
      alloc_size is calculated from num_agp_pages variable without overflow.
      This may lead to allocation of too small buffer with following buffer
      overflow.
      
      Another problem in agp code is not addressed in the patch - kernel memory
      exhaustion (AGPIOC_RESERVE and AGPIOC_ALLOCATE ioctls).  It is not checked
      whether requested pid is a pid of the caller (no check in agpioc_reserve_wrap()).
      Each allocation is limited to 16KB, though, there is no per-process limit.
      This might lead to OOM situation, which is not even solved in case of the
      caller death by OOM killer - the memory is allocated for another (faked) process.
      
      Signed-off-by: default avatarVasiliy Kulikov <segoon@openwall.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      b522f021
    • Linus Torvalds's avatar
      Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging · 584f7904
      Linus Torvalds authored
      * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
        hwmon: (max34440) Add driver documentation
        hwmon: (max16064) Add driver documentation
        hwmon: (max8688) Add driver documentation
        hwmon: (pmbus) Documentation updates
        hwmon: (smm665) Fix spelling error in driver documentation
        hwmon: (pmbus) Removed unused variable from struct pmbus_data
        hwmon: Add submitting-patches checklist to documentation
      584f7904
    • Linus Torvalds's avatar
      Merge branch 'for-2.6.39' of git://linux-nfs.org/~bfields/linux · 18995ba5
      Linus Torvalds authored
      * 'for-2.6.39' of git://linux-nfs.org/~bfields/linux:
        Open with O_CREAT flag set fails to open existing files on non writable directories
        nfsd4: Fix filp leak
        nfsd4: fix struct file leak on delegation
      18995ba5
    • Linus Torvalds's avatar
      Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm · f3e96492
      Linus Torvalds authored
      * 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm:
        ARM: 6881/1: cputype.h uses __attribute_const__ which requires including kernel.h
        ARM: Add new syscalls
      f3e96492
    • Linus Torvalds's avatar
      Merge branch 'stable/bug-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen · 8653b3f1
      Linus Torvalds authored
      * 'stable/bug-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
        xen: mask_rw_pte: do not apply the early_ioremap checks on x86_32
        xen: do not create the extra e820 region at an addr lower than 4G
      8653b3f1