1. 12 Jul, 2017 2 commits
    • Rafael J. Wysocki's avatar
      PCI / PM: Fix native PME handling during system suspend/resume · c7b5a4e6
      Rafael J. Wysocki authored
      Commit 76cde7e4 (PCI / PM: Make PCIe PME interrupts wake up from
      suspend-to-idle) went too far with preventing pcie_pme_work_fn() from
      clearing the root port's PME Status and re-enabling the PME interrupt
      which should be done for PMEs to work correctly after system resume.
      
      The failing scenario is as follows:
      
       1. pcie_pme_suspend() finds that the PME IRQ should be designated
          for system wakeup, so it calls enable_irq_wake() and then sets
          data->suspend_level to PME_SUSPEND_WAKEUP.
      
       2. PME interrupt happens at this point.
      
       3. pcie_pme_irq() runs, disables the PME interrupt and queues up
          the execution of pcie_pme_work_fn().
      
       4. pcie_pme_work_fn() runs before pcie_pme_resume() and breaks out
          of the loop right away, because data->suspend_level is not
          PME_SUSPEND_NONE, and it doesn't re-enable the PME interrupt
          for the same reason.
      
       5. pcie_pme_resume() runs and simply calls disable_irq_wake()
          without re-enabling the PME interrupt (because data->suspend_level
          is not PME_SUSPEND_NONE), so the PME interrupt remains disabled
          and the PME Status remains set.
      
      To fix this notice that there is no reason why pcie_pme_work_fn()
      should behave in a special way during system resume if the PME
      interrupt is not disabled by pcie_pme_suspend() and partially revert
      commit 76cde7e4 and restore the previous (and correct) behavior
      of pcie_pme_work_fn().
      
      Fixes: 76cde7e4 (PCI / PM: Make PCIe PME interrupts wake up from suspend-to-idle)
      Reported-and-tested-by: default avatarNaresh Solanki <naresh.solanki@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      c7b5a4e6
    • Rafael J. Wysocki's avatar
      PCI / PM: Restore PME Enable after config space restoration · 0ce3fcaf
      Rafael J. Wysocki authored
      Commit dc15e71e (PCI / PM: Restore PME Enable if skipping wakeup
      setup) introduced a mechanism by which the PME Enable bit can be
      restored by pci_enable_wake() if dev->wakeup_prepared is set in
      case it has been overwritten by PCI config space restoration.
      
      However, that commit overlooked the fact that on some systems (Dell
      XPS13 9360 in particular) the AML handling wakeup events checks PME
      Status and PME Enable and it won't trigger a Notify() for devices
      where those bits are not set while it is running.
      
      That happens during resume from suspend-to-idle when pci_restore_state()
      invoked by pci_pm_default_resume_early() clears PME Enable before the
      wakeup events are processed by AML, effectively causing those wakeup
      events to be ignored.
      
      Fix this issue by restoring the PME Enable configuration right after
      pci_restore_state() has been called instead of doing that in
      pci_enable_wake().
      
      Fixes: dc15e71e (PCI / PM: Restore PME Enable if skipping wakeup setup)
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      0ce3fcaf
  2. 27 Jun, 2017 5 commits
    • Rafael J. Wysocki's avatar
      PM / core: Drop run_wake flag from struct dev_pm_info · de3ef1eb
      Rafael J. Wysocki authored
      The run_wake flag in struct dev_pm_info is used to indicate whether
      or not the device is capable of generating remote wakeup signals at
      run time (or in the system working state), but the distinction
      between runtime remote wakeup and system wakeup signaling has always
      been rather artificial.  The only practical reason for it to exist
      at the core level was that ACPI and PCI treated those two cases
      differently, but that's not the case any more after recent changes.
      
      For this reason, get rid of the run_wake flag and, when applicable,
      use device_set_wakeup_capable() and device_can_wakeup() instead of
      device_set_run_wake() and device_run_wake(), respectively.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      de3ef1eb
    • Rafael J. Wysocki's avatar
      PCI / PM: Simplify device wakeup settings code · 0847684c
      Rafael J. Wysocki authored
      After previous changes it is not necessary to distinguish between
      device wakeup for run time and device wakeup from system sleep states
      any more, so rework the PCI device wakeup settings code accordingly.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      0847684c
    • Rafael J. Wysocki's avatar
      PCI / PM: Drop pme_interrupt flag from struct pci_dev · 8370c2dc
      Rafael J. Wysocki authored
      The pme_interrupt flag in struct pci_dev is set when PMEs generated
      by the device are going to be signaled via root port PME interrupts.
      
      Ironically enough, that information is only used by the code setting
      up device wakeup through ACPI which returns as soon as it sees the
      pme_interrupt flag set while setting up "remote runtime wakeup".
      That is questionable, however, because in theory there may be PCIe
      devices using out-of-band PME signaling under root ports handled
      by the native PME code or devices requiring wakeup power setup to be
      carried out by AML.  For such devices, ACPI wakeup should be invoked
      regardless of whether or not native PME signaling is used in general.
      
      For this reason, drop the pme_interrupt flag and rework the code
      using it which then allows the ACPI-based device wakeup handling
      in PCI to be consolidated to use one code path for both "runtime
      remote wakeup" and system wakeup (from sleep states).
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      8370c2dc
    • Rafael J. Wysocki's avatar
      ACPI / PM: Consolidate device wakeup settings code · 4d183d04
      Rafael J. Wysocki authored
      Currently, there are two separate ways of handling device wakeup
      settings in the ACPI core, depending on whether this is runtime
      wakeup or system wakeup (from sleep states).  However, after the
      previous commit eliminating the run_wake ACPI device wakeup flag,
      there is no difference between the two any more at the ACPI level,
      so they can be combined.
      
      For this reason, introduce acpi_pm_set_device_wakeup() to replace both
      acpi_pm_device_run_wake() and acpi_pm_device_sleep_wake() and make it
      check the ACPI device object's wakeup.valid flag to determine whether
      or not the device can be set up to generate wakeup signals.
      
      Also notice that zpodd_enable/disable_run_wake() only call
      device_set_run_wake() because acpi_pm_device_run_wake() called
      device_run_wake(), which is not done by acpi_pm_set_device_wakeup(),
      so drop the now redundant device_set_run_wake() calls from there.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      4d183d04
    • Rafael J. Wysocki's avatar
      ACPI / PM: Drop run_wake from struct acpi_device_wakeup_flags · a1a66393
      Rafael J. Wysocki authored
      The run_wake flag in struct acpi_device_wakeup_flags stores the
      information on whether or not the device can generate wakeup
      signals at run time, but in ACPI that really is equivalent to
      being able to generate wakeup signals at all.
      
      In fact, run_wake will always be set after successful executeion of
      acpi_setup_gpe_for_wake(), but if that fails, the device will not be
      able to use a wakeup GPE at all, so it won't be able to wake up the
      systems from sleep states too.  Hence, run_wake actually means that
      the device is capable of triggering wakeup and so it is equivalent
      to the valid flag.
      
      For this reason, drop run_wake from struct acpi_device_wakeup_flags
      and make sure that the valid flag is only set if
      acpi_setup_gpe_for_wake() has been successful.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      a1a66393
  3. 23 Jun, 2017 3 commits
    • Rafael J. Wysocki's avatar
      ACPI / sleep: EC-based wakeup from suspend-to-idle on recent systems · 8110dd28
      Rafael J. Wysocki authored
      Some recent Dell laptops, including the XPS13 model numbers 9360 and
      9365, cannot be woken up from suspend-to-idle by pressing the power
      button which is unexpected and makes that feature less usable on
      those systems.  Moreover, on the 9365 ACPI S3 (suspend-to-RAM) is
      not expected to be used at all (the OS these systems ship with never
      exercises the ACPI S3 path in the firmware) and suspend-to-idle is
      the only viable system suspend mechanism there.
      
      The reason why the power button wakeup from suspend-to-idle doesn't
      work on those systems is because their power button events are
      signaled by the EC (Embedded Controller), whose GPE (General Purpose
      Event) line is disabled during suspend-to-idle transitions in Linux.
      That is done on purpose, because in general the EC tends to be noisy
      for various reasons (battery and thermal updates and similar, for
      example) and all events signaled by it would kick the CPUs out of
      deep idle states while in suspend-to-idle, which effectively might
      defeat its purpose.
      
      Of course, on the Dell systems in question the EC GPE must be enabled
      during suspend-to-idle transitions for the button press events to
      be signaled while suspended at all, but fortunately there is a way
      out of this puzzle.
      
      First of all, those systems have the ACPI_FADT_LOW_POWER_S0 flag set
      in their ACPI tables, which means that the OS is expected to prefer
      the "low power S0 idle" system state over ACPI S3 on them.  That
      causes the most recent versions of other OSes to simply ignore ACPI
      S3 on those systems, so it is reasonable to expect that it should not
      be necessary to block GPEs during suspend-to-idle on them.
      
      Second, in addition to that, the systems in question provide a special
      firmware interface that can be used to indicate to the platform that
      the OS is transitioning into a system-wide low-power state in which
      certain types of activity are not desirable or that it is leaving
      such a state and that (in principle) should allow the platform to
      adjust its operation mode accordingly.
      
      That interface is a special _DSM object under a System Power
      Management Controller device (PNP0D80).  The expected way to use it
      is to invoke function 0 from it on system initialization, functions
      3 and 5 during suspend transitions and functions 4 and 6 during
      resume transitions (to reverse the actions carried out by the
      former).  In particular, function 5 from the "Low-Power S0" device
      _DSM is expected to cause the platform to put itself into a low-power
      operation mode which should include making the EC less verbose (so to
      speak).  Next, on resume, function 6 switches the platform back to
      the "working-state" operation mode.
      
      In accordance with the above, modify the ACPI suspend-to-idle code
      to look for the "Low-Power S0" _DSM interface on platforms with the
      ACPI_FADT_LOW_POWER_S0 flag set in the ACPI tables.  If it's there,
      use it during suspend-to-idle transitions as prescribed and avoid
      changing the GPE configuration in that case.  [That should reflect
      what the most recent versions of other OSes do.]
      
      Also modify the ACPI EC driver to make it handle events during
      suspend-to-idle in the usual way if the "Low-Power S0" _DSM interface
      is going to be used to make the power button events work while
      suspended on the Dell machines mentioned above
      
      Link: http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdfSigned-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8110dd28
    • Rafael J. Wysocki's avatar
      platform: x86: intel-hid: Wake up the system from suspend-to-idle · ef884112
      Rafael J. Wysocki authored
      Allow the intel-hid driver to wake up the system from suspend-to-idle
      by configuring its platform device as a wakeup one by default and
      switching it over to a system wakeup events triggering mode during
      system suspend transitions.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      ef884112
    • Rafael J. Wysocki's avatar
      platform: x86: intel-vbtn: Wake up the system from suspend-to-idle · 91f9e850
      Rafael J. Wysocki authored
      Allow the intel-vbtn driver to wake up the system from suspend-to-idle
      by configuring its platform device as a wakeup one by default and
      switching it over to a system wakeup events triggering mode during
      system suspend transitions.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      91f9e850
  4. 22 Jun, 2017 1 commit
  5. 14 Jun, 2017 8 commits
    • Rafael J. Wysocki's avatar
      ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle · 33e4f80e
      Rafael J. Wysocki authored
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled.  However, to preserve the existing
      behavior with respect to suspend-to-RAM, this only is done in
      the suspend-to-idle case and only if an SCI has occurred while
      suspended.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33e4f80e
    • Hans de Goede's avatar
      platform/x86: Add driver for ACPI INT0002 Virtual GPIO device · 63dada87
      Hans de Goede authored
      Some peripherals on Bay Trail and Cherry Trail platforms signal a
      Power Management Event (PME) to the Power Management Controller (PMC)
      to wakeup the system. When this happens software needs to explicitly
      clear the PME bus 0 status bit in the GPE0a_STS register to avoid an
      IRQ storm on IRQ 9.
      
      This is modelled in ACPI through the INT0002 ACPI device, which is
      called a "Virtual GPIO controller" in ACPI because it defines the
      event handler to call when the PME triggers through _AEI and _L02
      methods as would be done for a real GPIO interrupt in ACPI.
      
      This commit adds a driver which registers the Virtual GPIOs expected
      by the DSDT on these devices, letting gpiolib-acpi claim the
      virtual GPIO and install a GPIO-interrupt handler which call the _L02
      handler as it would for a real GPIO controller.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      63dada87
    • Rafael J. Wysocki's avatar
      PCI / PM: Restore PME Enable if skipping wakeup setup · dc15e71e
      Rafael J. Wysocki authored
      The wakeup_prepared PCI device flag is used for preventing subsequent
      changes of PCI device wakeup settings in the same way (e.g. enabling
      device wakeup twice in a row).
      
      However, in some cases PME Enable may be updated by things like PCI
      configuration space restoration in the meantime and it may need to be
      set again even though the rest of the settings need not change, so
      modify __pci_enable_wake() to do that when it is about to return
      early.
      
      Also, it is reasonable to expect that __pci_enable_wake() will always
      clear PME Status when invoked to disable device wakeup, so make it do
      so even if it is going to return early then.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      dc15e71e
    • Rafael J. Wysocki's avatar
      PM / sleep: Print timing information if debug is enabled · 604d8958
      Rafael J. Wysocki authored
      Avoid printing the device suspend/resume timing information if
      CONFIG_PM_DEBUG is not set to reduce the log noise level.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      604d8958
    • Rafael J. Wysocki's avatar
      ACPI / PM: Clean up device wakeup enable/disable code · 235d81a6
      Rafael J. Wysocki authored
      The wakeup.flags.enabled flag in struct acpi_device is not used
      consistently, as there is no reason why it should only apply
      to the enabling/disabling of the wakeup GPE, so put the invocation
      of acpi_enable_wakeup_device_power() under it too.
      
      Moreover, it is not necessary to call
      acpi_enable_wakeup_devices() and acpi_disable_wakeup_devices() for
      suspend-to-idle, so don't do that.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      235d81a6
    • Rafael J. Wysocki's avatar
      ACPI / PM: Change log level of wakeup-related message · 190cab84
      Rafael J. Wysocki authored
      Change the log level of the "System wakeup enabled/disabled by ACPI"
      message in acpi_pm_device_sleep_wake() to "debug" to reduce to log
      noise level.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      190cab84
    • Rafael J. Wysocki's avatar
      USB / PCI / PM: Allow the PCI core to do the resume cleanup · d438aa22
      Rafael J. Wysocki authored
      hcd_pci_resume_noirq() used as a universal _resume_noirq handler for
      PCI USB controllers calls pci_back_from_sleep() which is unnecessary
      and may become problematic.
      
      It is unnecessary, because the PCI bus type carries out post-suspend
      cleanup of all PCI devices during resume and that covers all things
      done by the pci_back_from_sleep().  There is no reason why USB cannot
      follow all of the other PCI devices in that respect.
      
      It will become problematic after subsequent changes that make it
      possible to go back to sleep again after executing dpm_resume_noirq()
      if no valid system wakeup events have been detected at that point.
      Namely, calling pci_back_from_sleep() at the _resume_noirq stage
      will cause the wakeup status of the devices in question to be cleared
      and if any of them has triggered system wakeup, that event may be
      missed then.
      
      For the above reasons, drop the pci_back_from_sleep() invocation
      from hcd_pci_resume_noirq().
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d438aa22
    • Rafael J. Wysocki's avatar
      ACPI / PM: Run wakeup notify handlers synchronously · 64fd1c70
      Rafael J. Wysocki authored
      The work functions provided by the users of acpi_add_pm_notifier()
      should be run synchronously before re-enabling the wakeup GPE in
      case they are used to clear the status and/or disable the wakeup
      signaling at the source.  Otherwise, which is the case currently in
      the PCI bus type code, the same wakeup event may be signaled for
      multiple times while the execution of the work function in response
      to it has already been queued up.
      
      Fortunately, acpi_add_pm_notifier() is only used by PCI and by
      ACPI device PM code internally, so the change is relatively
      straightforward to make.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      64fd1c70
  6. 11 Jun, 2017 15 commits
    • Linus Torvalds's avatar
      Linux 4.12-rc5 · 32c1431e
      Linus Torvalds authored
      32c1431e
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 32627645
      Linus Torvalds authored
      Pull key subsystem fixes from James Morris:
       "Here are a bunch of fixes for Linux keyrings, including:
      
         - Fix up the refcount handling now that key structs use the
           refcount_t type and the refcount_t ops don't allow a 0->1
           transition.
      
         - Fix a potential NULL deref after error in x509_cert_parse().
      
         - Don't put data for the crypto algorithms to use on the stack.
      
         - Fix the handling of a null payload being passed to add_key().
      
         - Fix incorrect cleanup an uninitialised key_preparsed_payload in
           key_update().
      
         - Explicit sanitisation of potentially secure data before freeing.
      
         - Fixes for the Diffie-Helman code"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (23 commits)
        KEYS: fix refcount_inc() on zero
        KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API
        crypto : asymmetric_keys : verify_pefile:zero memory content before freeing
        KEYS: DH: add __user annotations to keyctl_kdf_params
        KEYS: DH: ensure the KDF counter is properly aligned
        KEYS: DH: don't feed uninitialized "otherinfo" into KDF
        KEYS: DH: forbid using digest_null as the KDF hash
        KEYS: sanitize key structs before freeing
        KEYS: trusted: sanitize all key material
        KEYS: encrypted: sanitize all key material
        KEYS: user_defined: sanitize key payloads
        KEYS: sanitize add_key() and keyctl() key payloads
        KEYS: fix freeing uninitialized memory in key_update()
        KEYS: fix dereferencing NULL payload with nonzero length
        KEYS: encrypted: use constant-time HMAC comparison
        KEYS: encrypted: fix race causing incorrect HMAC calculations
        KEYS: encrypted: fix buffer overread in valid_master_desc()
        KEYS: encrypted: avoid encrypting/decrypting stack buffers
        KEYS: put keyring if install_session_keyring_to_cred() fails
        KEYS: Delete an error message for a failed memory allocation in get_derived_key()
        ...
      32627645
    • Linus Torvalds's avatar
      compiler, clang: properly override 'inline' for clang · 6d53cefb
      Linus Torvalds authored
      Commit abb2ea7d ("compiler, clang: suppress warning for unused
      static inline functions") just caused more warnings due to re-defining
      the 'inline' macro.
      
      So undef it before re-defining it, and also add the 'notrace' attribute
      like the gcc version that this is overriding does.
      
      Maybe this makes clang happier.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6d53cefb
    • Linus Torvalds's avatar
      Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random · 5ad9345d
      Linus Torvalds authored
      Pull randomness fixes from Ted Ts'o:
       "Improve performance by using a lockless update mechanism suggested by
        Linus, and make sure we refresh per-CPU entropy returned get_random_*
        as soon as the CRNG is initialized"
      
      * tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
        random: invalidate batched entropy after crng init
        random: use lockless method of accessing and updating f->reg_idx
      5ad9345d
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 5e38b72a
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Fix various bug fixes in ext4 caused by races and memory allocation
        failures"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fix fdatasync(2) after extent manipulation operations
        ext4: fix data corruption for mmap writes
        ext4: fix data corruption with EXT4_GET_BLOCKS_ZERO
        ext4: fix quota charging for shared xattr blocks
        ext4: remove redundant check for encrypted file on dio write path
        ext4: remove unused d_name argument from ext4_search_dir() et al.
        ext4: fix off-by-one error when writing back pages before dio read
        ext4: fix off-by-one on max nr_pages in ext4_find_unwritten_pgoff()
        ext4: keep existing extra fields when inode expands
        ext4: handle the rest of ext4_mb_load_buddy() ENOMEM errors
        ext4: fix off-by-in in loop termination in ext4_find_unwritten_pgoff()
        ext4: fix SEEK_HOLE
        jbd2: preserve original nofs flag during journal restart
        ext4: clear lockdep subtype for quota files on quota off
      5e38b72a
    • Linus Torvalds's avatar
      Merge tag 'gpio-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · f986e31b
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
       "A few overdue GPIO patches for the v4.12 kernel.
      
         - Fix debounce logic on the Aspeed platform.
      
         - Fix the "virtual gpio" things on the Intel Crystal Cove.
      
         - Fix the blink counter selection on the MVEBU platform"
      
      * tag 'gpio-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: mvebu: fix gpio bank registration when pwm is used
        gpio: mvebu: fix blink counter register selection
        MAINTAINERS: remove self from GPIO maintainers
        gpio: crystalcove: Do not write regular gpio registers for virtual GPIOs
        gpio: aspeed: Don't attempt to debounce if disabled
      f986e31b
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 9cd9cb0b
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are some small driver fixes for 4.12-rc5. Nothing major here,
        just some small bugfixes found by people testing, and a MAINTAINERS
        file update for the genwqe driver.
      
        All have been in linux-next with no reported issues"
      
      [ The cxl driver fix came in through the powerpc tree earlier ]
      
      * tag 'char-misc-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        cxl: Avoid double free_irq() for psl,slice interrupts
        mei: make sysfs modalias format similar as uevent modalias
        drivers: char: mem: Fix wraparound check to allow mappings up to the end
        MAINTAINERS: Change maintainer of genwqe driver
        goldfish_pipe: use GFP_ATOMIC under spin lock
        firmware: vpd: do not leak kobjects
        firmware: vpd: avoid potential use-after-free when destroying section
        firmware: vpd: do not leave freed section attributes to the list
      9cd9cb0b
    • Linus Torvalds's avatar
      Merge tag 'staging-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 21c9eb7c
      Linus Torvalds authored
      Pull staging/IIO fixes from Greg KH:
       "These are mostly all IIO driver fixes, resolving a number of tiny
        issues. There's also a ccree and lustre fix in here as well, both fix
        problems found in those codebases.
      
        All have been in linux-next with no reported issues"
      
      * tag 'staging-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: ccree: fix buffer copy
        staging/lustre/lov: remove set_fs() call from lov_getstripe()
        staging: ccree: add CRYPTO dependency
        iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function
        iio: light: ltr501 Fix interchanged als/ps register field
        iio: adc: bcm_iproc_adc: swap primary and secondary isr handler's
        iio: trigger: fix NULL pointer dereference in iio_trigger_write_current()
        iio: adc: max9611: Fix attribute measure unit
        iio: adc: ti_am335x_adc: allocating too much in probe
        iio: adc: sun4i-gpadc-iio: Fix module autoload when OF devices are registered
        iio: adc: sun4i-gpadc-iio: Fix module autoload when PLATFORM devices are registered
        iio: proximity: as3935: fix iio_trigger_poll issue
        iio: proximity: as3935: fix AS3935_INT mask
        iio: adc: Max9611: checking for ERR_PTR instead of NULL in probe
        iio: proximity: as3935: recalibrate RCO after resume
      21c9eb7c
    • Linus Torvalds's avatar
      Merge tag 'usb-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 246baac2
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for 4.12-rc5
      
        They are for some reported issues in the chipidea and gadget drivers.
        Nothing major. All have been in linux-next for a while with no
        reported issues"
      
      * tag 'usb-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: gadget: udc: renesas_usb3: Fix PN_INT_ENA disabling timing
        usb: gadget: udc: renesas_usb3: lock for PN_ registers access
        usb: gadget: udc: renesas_usb3: fix deadlock by spinlock
        usb: gadget: udc: renesas_usb3: fix pm_runtime functions calling
        usb: gadget: f_mass_storage: Serialize wake and sleep execution
        usb: dwc2: add support for the DWC2 controller on Meson8 SoCs
        phy: qualcomm: phy-qcom-qmp: fix application of sizeof to pointer
        usb: musb: dsps: keep VBUS on for host-only mode
        usb: chipidea: core: check before accessing ci_role in ci_role_show
        usb: chipidea: debug: check before accessing ci_role
        phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()
        usb: chipidea: udc: fix NULL pointer dereference if udc_start failed
        usb: chipidea: imx: Do not access CLKONOFF on i.MX51
      246baac2
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · ef918d3c
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a set of user visible fixes (excepting one format string
        change).
      
        Four of the qla2xxx fixes only affect the firmware dump path, but it's
        still important to the enterprise. The rest are various NULL pointer
        crash conditions or outright driver hangs"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: cxgb4i: libcxgbi: in error case RST tcp conn
        scsi: scsi_debug: Avoid PI being disabled when TPGS is enabled
        scsi: qla2xxx: Fix extraneous ref on sp's after adapter break
        scsi: lpfc: prevent potential null pointer dereference
        scsi: lpfc: Avoid NULL pointer dereference in lpfc_els_abort()
        scsi: lpfc: nvmet_fc: fix format string
        scsi: qla2xxx: Fix crash due to NULL pointer dereference of ctx
        scsi: qla2xxx: Fix mailbox pointer error in fwdump capture
        scsi: qla2xxx: Set bit 15 for DIAG_ECHO_TEST MBC
        scsi: qla2xxx: Modify T262 FW dump template to specify same start/end to debug customer issues
        scsi: qla2xxx: Fix crash due to mismatch mumber of Q-pair creation for Multi queue
        scsi: qla2xxx: Fix NULL pointer access due to redundant fc_host_port_name call
        scsi: qla2xxx: Fix recursive loop during target mode configuration for ISP25XX leaving system unresponsive
        scsi: bnx2fc: fix race condition in bnx2fc_get_host_stats()
        scsi: qla2xxx: don't disable a not previously enabled PCI device
      ef918d3c
    • Linus Torvalds's avatar
      Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 8f56821d
      Linus Torvalds authored
      Pull libnvdimm fix from Dan Williams:
       "We expanded the device-dax fs type in 4.12 to be a generic provider of
        a struct dax_device with an embedded inode. However, Sasha found some
        basic negative testing was not run to verify that this fs cleanly
        handles being mounted directly.
      
        Note that the fresh rebase was done to remove an unnecessary Cc:
        <stable> tag, but this commit otherwise had a build success
        notification from the 0day robot."
      
      * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        device-dax: fix 'dax' device filesystem inode destruction crash
      8f56821d
    • Linus Torvalds's avatar
      Merge tag 'hexagon-for-linus-v4.12-rc5' of... · 9d66af6b
      Linus Torvalds authored
      Merge tag 'hexagon-for-linus-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hexagon fix from Guenter Roeck:
       "This fixes a build error seen when building hexagon images.
      
        Richard sent me an Ack, but didn't reply when asked if he wants me to
        send the patch to you directly, so I figured I'd just do it"
      
      * tag 'hexagon-for-linus-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hexagon: Use raw_copy_to_user
      9d66af6b
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 9d0eb462
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "Bug fixes (ARM, s390, x86)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: async_pf: avoid async pf injection when in guest mode
        KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation
        arm: KVM: Allow unaligned accesses at HYP
        arm64: KVM: Allow unaligned accesses at EL2
        arm64: KVM: Preserve RES1 bits in SCTLR_EL2
        KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages
        KVM: nVMX: Fix exception injection
        kvm: async_pf: fix rcu_irq_enter() with irqs enabled
        KVM: arm/arm64: vgic-v3: Fix nr_pre_bits bitfield extraction
        KVM: s390: fix ais handling vs cpu model
        KVM: arm/arm64: Fix isues with GICv2 on GICv3 migration
      9d0eb462
    • Wanpeng Li's avatar
      KVM: async_pf: avoid async pf injection when in guest mode · 9bc1f09f
      Wanpeng Li authored
       INFO: task gnome-terminal-:1734 blocked for more than 120 seconds.
             Not tainted 4.12.0-rc4+ #8
       "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
       gnome-terminal- D    0  1734   1015 0x00000000
       Call Trace:
        __schedule+0x3cd/0xb30
        schedule+0x40/0x90
        kvm_async_pf_task_wait+0x1cc/0x270
        ? __vfs_read+0x37/0x150
        ? prepare_to_swait+0x22/0x70
        do_async_page_fault+0x77/0xb0
        ? do_async_page_fault+0x77/0xb0
        async_page_fault+0x28/0x30
      
      This is triggered by running both win7 and win2016 on L1 KVM simultaneously,
      and then gives stress to memory on L1, I can observed this hang on L1 when
      at least ~70% swap area is occupied on L0.
      
      This is due to async pf was injected to L2 which should be injected to L1,
      L2 guest starts receiving pagefault w/ bogus %cr2(apf token from the host
      actually), and L1 guest starts accumulating tasks stuck in D state in
      kvm_async_pf_task_wait() since missing PAGE_READY async_pfs.
      
      This patch fixes the hang by doing async pf when executing L1 guest.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9bc1f09f
    • Guenter Roeck's avatar
      hexagon: Use raw_copy_to_user · 4d801cca
      Guenter Roeck authored
      Commit ac4691fa ("hexagon: switch to RAW_COPY_USER") replaced
      __copy_to_user_hexagon() with raw_copy_to_user(), but did not catch
      all callers, resulting in the following build error.
      
      arch/hexagon/mm/uaccess.c: In function '__clear_user_hexagon':
      arch/hexagon/mm/uaccess.c:40:3: error:
      	implicit declaration of function '__copy_to_user_hexagon'
      
      Fixes: ac4691fa ("hexagon: switch to RAW_COPY_USER")
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Acked-by: default avatarRichard Kuo <rkuo@codeaurora.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      4d801cca
  7. 10 Jun, 2017 6 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 5faab9e0
      Linus Torvalds authored
      Pull UFS fixes from Al Viro:
       "This is just the obvious backport fodder; I'm pretty sure that there
        will be more - definitely so wrt performance and quite possibly
        correctness as well"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        ufs: we need to sync inode before freeing it
        excessive checks in ufs_write_failed() and ufs_evict_inode()
        ufs_getfrag_block(): we only grab ->truncate_mutex on block creation path
        ufs_extend_tail(): fix the braino in calling conventions of ufs_new_fragments()
        ufs: set correct ->s_maxsize
        ufs: restore maintaining ->i_blocks
        fix ufs_isblockset()
        ufs: restore proper tail allocation
      5faab9e0
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 66cea28a
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "Some fixes that Dave Sterba collected.
      
        We've been hitting an early enospc problem on production machines that
        Omar tracked down to an old int->u64 mistake. I waited a bit on this
        pull to make sure it was really the problem from production, but it's
        on ~2100 hosts now and I think we're good.
      
        Omar also noticed a commit in the queue would make new early ENOSPC
        problems. I pulled that out for now, which is why the top three
        commits are younger than the rest.
      
        Otherwise these are all fixes, some explaining very old bugs that
        we've been poking at for a while"
      
      * 'for-linus-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix delalloc accounting leak caused by u32 overflow
        Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
        btrfs: tree-log.c: Wrong printk information about namelen
        btrfs: fix race with relocation recovery and fs_root setup
        btrfs: fix memory leak in update_space_info failure path
        btrfs: use correct types for page indices in btrfs_page_exists_in_range
        btrfs: fix incorrect error return ret being passed to mapping_set_error
        btrfs: Make flush bios explicitely sync
        btrfs: fiemap: Cache and merge fiemap extent before submit it to user
      66cea28a
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ac1a14a2
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes: a Geode fix plus a microcode loader fix"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/microcode/intel: Clear patch pointer before jettisoning the initrd
        x86/cpu/cyrix: Add alternative Device ID of Geode GX1 SoC
      ac1a14a2
    • Linus Torvalds's avatar
      Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 45b44f0f
      Linus Torvalds authored
      Pull CPU hotplug fix from Ingo Molnar:
       "An error handling corner case fix"
      
      * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpu/hotplug: Drop the device lock on error
      45b44f0f
    • Linus Torvalds's avatar
      Merge branch 'rcu-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 6b7ed458
      Linus Torvalds authored
      Pull RCU fixes from Ingo Molnar:
       "Fix an SRCU bug affecting KVM IRQ injection"
      
      * 'rcu-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        srcu: Allow use of Classic SRCU from both process and interrupt context
        srcu: Allow use of Tiny/Tree SRCU from both process and interrupt context
      6b7ed458
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f701d860
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "This is mostly tooling fixes, plus an instruction pointer filtering
        fix.
      
        It's more fixes than usual - Arnaldo got back from a longer vacation
        and there was a backlog"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
        perf symbols: Kill dso__build_id_is_kmod()
        perf symbols: Keep DSO->symtab_type after decompress
        perf tests: Decompress kernel module before objdump
        perf tools: Consolidate error path in __open_dso()
        perf tools: Decompress kernel module when reading DSO data
        perf annotate: Use dso__decompress_kmodule_path()
        perf tools: Introduce dso__decompress_kmodule_{fd,path}
        perf tools: Fix a memory leak in __open_dso()
        perf annotate: Fix symbolic link of build-id cache
        perf/core: Drop kernel samples even though :u is specified
        perf script python: Remove dups in documentation examples
        perf script python: Updated trace_unhandled() signature
        perf script python: Fix wrong code snippets in documentation
        perf script: Fix documentation errors
        perf script: Fix outdated comment for perf-trace-python
        perf probe: Fix examples section of documentation
        perf report: Ensure the perf DSO mapping matches what libdw sees
        perf report: Include partial stacks unwound with libdw
        perf annotate: Add missing powerpc triplet
        perf test: Disable breakpoint signal tests for powerpc
        ...
      f701d860