1. 18 Apr, 2016 1 commit
    • Linus Torvalds's avatar
      devpts: clean up interface to pty drivers · 67245ff3
      Linus Torvalds authored
      This gets rid of the horrible notion of having that
      
          struct inode *ptmx_inode
      
      be the linchpin of the interface between the pty code and devpts.
      
      By de-emphasizing the ptmx inode, a lot of things actually get cleaner,
      and we will have a much saner way forward.  In particular, this will
      allow us to associate with any particular devpts instance at open-time,
      and not be artificially tied to one particular ptmx inode.
      
      The patch itself is actually fairly straightforward, and apart from some
      locking and return path cleanups it's pretty mechanical:
      
       - the interfaces that devpts exposes all take "struct pts_fs_info *"
         instead of "struct inode *ptmx_inode" now.
      
         NOTE! The "struct pts_fs_info" thing is a completely opaque structure
         as far as the pty driver is concerned: it's still declared entirely
         internally to devpts. So the pty code can't actually access it in any
         way, just pass it as a "cookie" to the devpts code.
      
       - the "look up the pts fs info" is now a single clear operation, that
         also does the reference count increment on the pts superblock.
      
         So "devpts_add/del_ref()" is gone, and replaced by a "lookup and get
         ref" operation (devpts_get_ref(inode)), along with a "put ref" op
         (devpts_put_ref()).
      
       - the pty master "tty->driver_data" field now contains the pts_fs_info,
         not the ptmx inode.
      
       - because we don't care about the ptmx inode any more as some kind of
         base index, the ref counting can now drop the inode games - it just
         gets the ref on the superblock.
      
       - the pts_fs_info now has a back-pointer to the super_block. That's so
         that we can easily look up the information we actually need. Although
         quite often, the pts fs info was actually all we wanted, and not having
         to look it up based on some magical inode makes things more
         straightforward.
      
      In particular, now that "devpts_get_ref(inode)" operation should really
      be the *only* place we need to look up what devpts instance we're
      associated with, and we do it exactly once, at ptmx_open() time.
      
      The other side of this is that one ptmx node could now be associated
      with multiple different devpts instances - you could have a single
      /dev/ptmx node, and then have multiple mount namespaces with their own
      instances of devpts mounted on /dev/pts/.  And that's all perfectly sane
      in a model where we just look up the pts instance at open time.
      
      This will eventually allow us to get rid of our odd single-vs-multiple
      pts instance model, but this patch in itself changes no semantics, only
      an internal binding model.
      
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Anvin <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: Serge Hallyn <serge.hallyn@ubuntu.com>
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
      Cc: Jann Horn <jann@thejh.net>
      Cc: Greg KH <greg@kroah.com>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Florian Weimer <fw@deneb.enyo.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      67245ff3
  2. 15 Apr, 2016 17 commits
  3. 14 Apr, 2016 13 commits
    • Mike Snitzer's avatar
      dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros · 9567366f
      Mike Snitzer authored
      The READ_LOCK macro was incorrectly returning -EINVAL if
      dm_bm_is_read_only() was true -- it will always be true once the cache
      metadata transitions to read-only by dm_cache_metadata_set_read_only().
      
      Wrap READ_LOCK and WRITE_LOCK multi-statement macros in do {} while(0).
      Also, all accesses of the 'cmd' argument passed to these related macros
      are now encapsulated in parenthesis.
      
      A follow-up patch can be developed to eliminate the use of macros in
      favor of pure C code.  Avoiding that now given that this needs to apply
      to stable@.
      Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Fixes: d14fcf3d ("dm cache: make sure every metadata function checks fail_io")
      Cc: stable@vger.kernel.org
      9567366f
    • Keith Busch's avatar
      NVMe: Always use MSI/MSI-x interrupts · a5229050
      Keith Busch authored
      Multiple users have reported device initialization failure due the driver
      not receiving legacy PCI interrupts. This is not unique to any particular
      controller, but has been observed on multiple platforms.
      
      There have been no issues reported or observed when with message signaled
      interrupts, so this patch attempts to use MSI-x during initialization,
      falling back to MSI. If that fails, legacy would become the default.
      
      The setup_io_queues error handling had to change as a result: the admin
      queue's msix_entry used to be initialized to the legacy IRQ. The case
      where nr_io_queues is 0 would fail request_irq when setting up the admin
      queue's interrupt since re-enabling MSI-x fails with 0 vectors, leaving
      the admin queue's msix_entry invalid. Instead, return success immediately.
      Reported-by: default avatarTim Muhlemmer <muhlemmer@gmail.com>
      Reported-by: default avatarJon Derrick <jonathan.derrick@intel.com>
      Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      a5229050
    • Linus Torvalds's avatar
      /proc/iomem: only expose physical resource addresses to privileged users · 51d7b120
      Linus Torvalds authored
      In commit c4004b02 ("x86: remove the kernel code/data/bss resources
      from /proc/iomem") I was hoping to remove the phyiscal kernel address
      data from /proc/iomem entirely, but that had to be reverted because some
      system programs actually use it.
      
      This limits all the detailed resource information to properly
      credentialed users instead.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      51d7b120
    • Linus Torvalds's avatar
      pci-sysfs: use proper file capability helper function · ab0fa82b
      Linus Torvalds authored
      The PCI config access checked the file capabilities correctly, but used
      the itnernal security capability check rather than the helper function
      that is actually meant for that.
      
      The security_capable() has unusual return values and is not meant to be
      used elsewhere (the only other use is in the capability checking
      functions that we actually intend people to use, and this odd PCI usage
      really stood out when looking around the capability code.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ab0fa82b
    • Linus Torvalds's avatar
      Make file credentials available to the seqfile interfaces · 34dbbcdb
      Linus Torvalds authored
      A lot of seqfile users seem to be using things like %pK that uses the
      credentials of the current process, but that is actually completely
      wrong for filesystem interfaces.
      
      The unix semantics for permission checking files is to check permissions
      at _open_ time, not at read or write time, and that is not just a small
      detail: passing off stdin/stdout/stderr to a suid application and making
      the actual IO happen in privileged context is a classic exploit
      technique.
      
      So if we want to be able to look at permissions at read time, we need to
      use the file open credentials, not the current ones.  Normal file
      accesses can just use "f_cred" (or any of the helper functions that do
      that, like file_ns_capable()), but the seqfile interfaces do not have
      any such options.
      
      It turns out that seq_file _does_ save away the user_ns information of
      the file, though.  Since user_ns is just part of the full credential
      information, replace that special case with saving off the cred pointer
      instead, and suddenly seq_file has all the permission information it
      needs.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34dbbcdb
    • Linus Torvalds's avatar
      Revert "x86: remove the kernel code/data/bss resources from /proc/iomem" · 4046d6e8
      Linus Torvalds authored
      This reverts commit c4004b02.
      
      Sadly, my hope that nobody would actually use the special kernel entries
      in /proc/iomem were dashed by kexec.  Which reads /proc/iomem explicitly
      to find the kernel base address.  Nasty.
      
      Anyway, that means we can't do the sane and simple thing and just remove
      the entries, and we'll instead have to mask them out based on permissions.
      Reported-by: default avatarZhengyu Zhang <zhezhang@redhat.com>
      Reported-by: default avatarDave Young <dyoung@redhat.com>
      Reported-by: default avatarFreeman Zhang <freeman.zhang1992@gmail.com>
      Reported-by: default avatarEmrah Demir <ed@abdsec.com>
      Reported-by: default avatarBaoquan He <bhe@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4046d6e8
    • Helge Deller's avatar
      parisc: Fix ftrace function tracer · 366dd4ea
      Helge Deller authored
      Fix the FTRACE function tracer for 32- and 64-bit kernel.
      The former code was horribly broken.
      
      Reimplement most coding in assembly and utilize optimizations, e.g. put
      mcount() and ftrace_stub() into one L1 cacheline.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      366dd4ea
    • Toshi Kani's avatar
      pmem: fix BUG() error in pmem.h:48 on X86_32 · cba2e47a
      Toshi Kani authored
      After 'commit fc0c2028 ("x86, pmem: use memcpy_mcsafe()
      for memcpy_from_pmem()")', probing a PMEM device hits the BUG()
      error below on X86_32 kernel.
      
       kernel BUG at include/linux/pmem.h:48!
      
      memcpy_from_pmem() calls arch_memcpy_from_pmem(), which is
      unimplemented since CONFIG_ARCH_HAS_PMEM_API is undefined on
      X86_32.
      
      Fix the BUG() error by adding default_memcpy_from_pmem().
      Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      cba2e47a
    • Stefan Agner's avatar
      pwm: fsl-ftm: Use flat regmap cache · ad06fdee
      Stefan Agner authored
      Use flat regmap cache to avoid lockdep warning at probe:
      
      [    0.697285] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2755 lockdep_trace_alloc+0x15c/0x160()
      [    0.697449] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
      
      The RB-tree regmap cache needs to allocate new space on first writes.
      However, allocations in an atomic context (e.g. when a spinlock is held)
      are not allowed. The function regmap_write calls map->lock, which
      acquires a spinlock in the fast_io case. Since the pwm-fsl-ftm driver
      uses MMIO, the regmap bus of type regmap_mmio is being used which has
      fast_io set to true.
      
      The MMIO space of the pwm-fsl-ftm driver is reasonable condense, hence
      using the much faster flat regmap cache is anyway the better choice.
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      ad06fdee
    • Jon Hunter's avatar
      mmc: tegra: Disable UHS-I modes for Tegra124 · 70ad7f7e
      Jon Hunter authored
      Tegra124 has been randomly hanging during system suspend when entering
      the Tegra LP1 low power state. The hang is caused by the Tegra SDHCI
      driver and linked to the UHS-I tuning sequence. Disabling the UHS-I
      modes for Tegra124 prevents any hangs from occurring when entering
      system suspend.
      
      Unfortunately, the tuning sequence described in the public Tegra
      documentation is incomplete and on inspection of the current tuning
      sequence that has been implemented is also incomplete and may cause
      problems. In the short-term it is safer to disable UHS-I modes for now
      and fix later because it would be too large of a change to simply patch
      now. Therefore, disable UHS-I modes for Tegra124.
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Acked-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      70ad7f7e
    • Ulf Hansson's avatar
      mmc: block: Use the mmc host device index as the mmcblk device index · 9aaf3437
      Ulf Hansson authored
      Commit 520bd7a8 ("mmc: core: Optimize boot time by detecting cards
      simultaneously") causes regressions for some platforms.
      
      These platforms relies on fixed mmcblk device indexes, instead of
      deploying the defacto standard with UUID/PARTUUID. In other words their
      rootfs needs to be available at hardcoded paths, like /dev/mmcblk0p2.
      
      Such guarantees have never been made by the kernel, but clearly the above
      commit changes the behaviour. More precisely, because of that the order
      changes of how cards becomes detected, so do their corresponding mmcblk
      device indexes.
      
      As the above commit significantly improves boot time for some platforms
      (magnitude of seconds), let's avoid reverting this change but instead
      restore the behaviour of how mmcblk device indexes becomes picked.
      
      By using the same index for the mmcblk device as for the corresponding mmc
      host device, the probe order of mmc host devices decides the index we get
      for the mmcblk device.
      
      For those platforms that suffers from a regression, one could expect that
      this updated behaviour should be sufficient to meet their expectations of
      "fixed" mmcblk device indexes.
      
      Another side effect from this change, is that the same index is used for
      the mmc host device, the mmcblk device and the mmc block queue. That
      should clarify their relationship.
      Reported-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Reported-by: default avatarLaszlo Fiat <laszlo.fiat@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Fixes: 520bd7a8 ("mmc: core: Optimize boot time by detecting cards
      simultaneously")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      9aaf3437
    • Dave Airlie's avatar
      Merge branch 'exynos-drm-fixes' of... · ff3e84e8
      Dave Airlie authored
      Merge branch 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes
      
      fix some exynos regressions.
      
      * 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
        drm/exynos: Use VIDEO_SAMSUNG_S5P_G2D=n as G2D Kconfig dependency
        drm/exynos: fix a warning message
        drm/exynos: mic: fix an error code
        drm/exynos: fimd: fix broken dp_clock control
        drm/exynos: build fbdev code conditionally
        drm/exynos: fix adjusted_mode pointer in exynos_plane_mode_set
        drm/exynos: fix error handling in exynos_drm_subdrv_open
      ff3e84e8
    • Dave Airlie's avatar
      Merge branch 'drm-fixes-4.6' of git://people.freedesktop.org/~agd5f/linux into drm-fixes · 25451c19
      Dave Airlie authored
      some misc radeon fixes.
      
      * 'drm-fixes-4.6' of git://people.freedesktop.org/~agd5f/linux:
        drm/amd/amdgpu: fix irq domain remove for tonga ih
        drm/radeon: use helper for mst connector dpms.
        drm/radeon/mst: port some MST setup code from DAL.
        drm/amdgpu: add invisible pin size statistic
      25451c19
  4. 13 Apr, 2016 9 commits
    • Linus Torvalds's avatar
      Merge tag 'sh-fixes-4.6-rc1' of git://git.libc.org/linux-sh · 90de6800
      Linus Torvalds authored
      Pull arch/sh fixes from Rich Felker:
       "Fixes for two arch/sh build regressions that appeared in 4.6-rc1, one
        introduced by me, and one caused by changes elsewhere"
      
      * tag 'sh-fixes-4.6-rc1' of git://git.libc.org/linux-sh:
        sh: fix function signature of cpu_coregroup_mask to match pointer type
        sh: fix smp-shx3 build regression from removal of arch localtimer
      90de6800
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · 5b523ff2
      Linus Torvalds authored
      Pull m68knommu/coldfire fix from Greg Ungerer:
       "Only a single change that removes a local arch specific gpio bus sysfs
        device that now clashes with the generic gpio bus sysfs device
        interface"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68k/gpio: remove arch specific sysfs bus device
      5b523ff2
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · e0127662
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A batch of fixes for -rc4, for various platforms.
      
        Nothing really substantial and worth pointing out in particular; small
        fixes for various bugs, see shortlog for details"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        ARM: sa1100: remove references to the defunct handhelds.org
        bus: uniphier-system-bus: fix condition of overlap check
        ARM: uniphier: drop weird sizeof()
        ARM: dts: am335x-baltos-ir5221: fix cpsw_emac0 link type
        ARM: OMAP: Correct interrupt type for ARM TWD
        ARM: DRA722: Add ID detect for Silicon Rev 2.0
        ARM: dts: am43xx: fix edma memcpy channel allocation
        ARM: dts: AM43x-epos: Fix clk parent for synctimer
        ARM: OMAP2: Fix up interconnect barrier initialization for DRA7
        documentation: Fix pinctrl documentation for Meson8 / Meson8b
        ARM: dts: amlogic: Split pinctrl device for Meson8 / Meson8b
        ARM: mvebu: Correct unit address for linksys
        bus: mvebu-mbus: use %pa to print phys_addr_t
        arm64: dts: vulcan: Update PCI ranges
        ARM: u8500_defconfig: turn on the Synaptics RMI4 driver
        ARM: pxa: fix the number of DMA requestor lines
        ARM: OMAP2+: hwmod: Fix updating of sysconfig register
        ARM: OMAP2+: Use srst_udelay for USB on dm814x
      e0127662
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 5e1b59ab
      Linus Torvalds authored
      Pull KVM fixes from Radim Krčmář:
       "ARM fixes:
         - Wrong indentation in the PMU code from the merge window
         - A long-time bug occuring with running ntpd on the host, candidate
           for stable
         - Properly handle (and warn about) the unsupported configuration of
           running on systems with less than 40 bits of PA space
         - More fixes to the PM and hotplug notifier stuff from the merge
           window
      
        x86:
         - leak of guest xcr0 (typically shows up as SIGILL)
         - new maintainer (who is sending the pull request too)
         - fix for merge window regression
         - fix for guest CPUID"
      
      Paolo Bonzini points out:
       "For the record, this tag is signed by me because I prepared the pull
        request.  Further pull requests for 4.6 will be signed and sent out by
        Radim directly"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: mask CPUID(0xD,0x1).EAX against host value
        kvm: x86: do not leak guest xcr0 into host interrupt handlers
        KVM: MMU: fix permission_fault()
        KVM: new maintainer on the block
        arm64: KVM: unregister notifiers in hyp mode teardown path
        arm64: KVM: Warn when PARange is less than 40 bits
        KVM: arm/arm64: Handle forward time correction gracefully
        arm64: KVM: Add braces to multi-line if statement in virtual PMU code
      5e1b59ab
    • Tony Luck's avatar
      x86/mce: Avoid using object after free in genpool · a3125494
      Tony Luck authored
      When we loop over all queued machine check error records to pass them
      to the registered notifiers we use llist_for_each_entry(). But the loop
      calls gen_pool_free() for the entry in the body of the loop - and then
      the iterator looks at node->next after the free.
      
      Use llist_for_each_entry_safe() instead.
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Cc: Gong Chen <gong.chen@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/0205920@agluck-desk.sc.intel.com
      Link: http://lkml.kernel.org/r/1459929916-12852-4-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a3125494
    • Takashi Iwai's avatar
      ALSA: hda - Fix inconsistent monitor_present state until repoll · c44da62b
      Takashi Iwai authored
      While the previous commit fixed the missing monitor_present flag
      update, it may be still in an inconsistent state while the driver
      repolls: the flag itself is updated, but the eld_valid flag and the
      contents don't follow until the repoll finishes (and may be repeated
      for a few times).
      
      The basic problem is that pin_eld->monitor_present is updated in the
      caller side.  This should have been updated only in update_eld().  So,
      the proper fix is to avoid accessing pin_eld but only spec->temp_eld.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c44da62b
    • Hyungwon Hwang's avatar
      ALSA: hda - Fix regression of monitor_present flag in eld proc file · 023d8218
      Hyungwon Hwang authored
      The commit [bd481285: ALSA: hda - Fix forgotten HDMI
      monitor_present update] covered the missing update of monitor_present
      flag, but this caused a regression for devices without the i915 eld
      notifier.  Since the old code supposed that pin_eld->monitor_present
      was updated by the caller side, the hdmi_present_sense_via_verbs()
      doesn't update the temporary eld->monitor_present but only
      pin_eld->monitor_present, which is now overridden in update_eld().
      
      The fix is to update pin_eld->monitor_present as well before calling
      update_eld().
      
      Note that this may still leave monitor_present flag in an inconsistent
      state when the driver repolls, but this is at least the old behavior.
      More proper fix will follow in the later patch.
      
      Fixes: bd481285 ('ALSA: hda - Fix forgotten HDMI monitor_present update')
      Signed-off-by: default avatarHyungwon Hwang <hyungwon.hwang7@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      023d8218
    • Jaegeuk Kim's avatar
      ext4/fscrypto: avoid RCU lookup in d_revalidate · 03a8bb0e
      Jaegeuk Kim authored
      As Al pointed, d_revalidate should return RCU lookup before using d_inode.
      This was originally introduced by:
      commit 34286d66 ("fs: rcu-walk aware d_revalidate method").
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: stable <stable@vger.kernel.org>
      03a8bb0e
    • James Morris's avatar
      Merge tag 'keys-fixes-20160412' of... · 58976eef
      James Morris authored
      Merge tag 'keys-fixes-20160412' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into for-linus
      58976eef