1. 29 Dec, 2017 4 commits
    • Jon Hunter's avatar
      mfd: cros ec: spi: Don't send first message too soon · 2db85cb2
      Jon Hunter authored
      commit 15d83748 upstream.
      
      On the Tegra124 Nyan-Big chromebook the very first SPI message sent to
      the EC is failing.
      
      The Tegra SPI driver configures the SPI chip-selects to be active-high
      by default (and always has for many years). The EC SPI requires an
      active-low chip-select and so the Tegra chip-select is reconfigured to
      be active-low when the EC SPI driver calls spi_setup(). The problem is
      that if the first SPI message to the EC is sent too soon after
      reconfiguring the SPI chip-select, it fails.
      
      The EC SPI driver prevents back-to-back SPI messages being sent too
      soon by keeping track of the time the last transfer was sent via the
      variable 'last_transfer_ns'. To prevent the very first transfer being
      sent too soon, initialise the 'last_transfer_ns' variable after calling
      spi_setup() and before sending the first SPI message.
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: default avatarBrian Norris <briannorris@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarBenson Leung <bleung@chromium.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2db85cb2
    • Sebastian Andrzej Siewior's avatar
      crypto: mcryptd - protect the per-CPU queue with a lock · e81cff1c
      Sebastian Andrzej Siewior authored
      commit 9abffc6f upstream.
      
      mcryptd_enqueue_request() grabs the per-CPU queue struct and protects
      access to it with disabled preemption. Then it schedules a worker on the
      same CPU. The worker in mcryptd_queue_worker() guards access to the same
      per-CPU variable with disabled preemption.
      
      If we take CPU-hotplug into account then it is possible that between
      queue_work_on() and the actual invocation of the worker the CPU goes
      down and the worker will be scheduled on _another_ CPU. And here the
      preempt_disable() protection does not work anymore. The easiest thing is
      to add a spin_lock() to guard access to the list.
      
      Another detail: mcryptd_queue_worker() is not processing more than
      MCRYPTD_BATCH invocation in a row. If there are still items left, then
      it will invoke queue_work() to proceed with more later. *I* would
      suggest to simply drop that check because it does not use a system
      workqueue and the workqueue is already marked as "CPU_INTENSIVE". And if
      preemption is required then the scheduler should do it.
      However if queue_work() is used then the work item is marked as CPU
      unbound. That means it will try to run on the local CPU but it may run
      on another CPU as well. Especially with CONFIG_DEBUG_WQ_FORCE_RR_CPU=y.
      Again, the preempt_disable() won't work here but lock which was
      introduced will help.
      In order to keep work-item on the local CPU (and avoid RR) I changed it
      to queue_work_on().
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e81cff1c
    • Dan Williams's avatar
      acpi, nfit: fix health event notification · d31a207a
      Dan Williams authored
      commit adf68957 upstream.
      
      Integration testing with a BIOS that generates injected health event
      notifications fails to communicate those events to userspace. The nfit
      driver neglects to link the ACPI DIMM device with the necessary driver
      data so acpi_nvdimm_notify() fails this lookup:
      
              nfit_mem = dev_get_drvdata(dev);
              if (nfit_mem && nfit_mem->flags_attr)
                      sysfs_notify_dirent(nfit_mem->flags_attr);
      
      Add the necessary linkage when installing the notification handler and
      clean it up when the nfit driver instance is torn down.
      
      Cc: Toshi Kani <toshi.kani@hpe.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Fixes: ba9c8dd3 ("acpi, nfit: add dimm device notification support")
      Reported-by: default avatarDaniel Osawa <daniel.k.osawa@intel.com>
      Tested-by: default avatarDaniel Osawa <daniel.k.osawa@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d31a207a
    • Takashi Iwai's avatar
      ACPI: APEI / ERST: Fix missing error handling in erst_reader() · 54c74d38
      Takashi Iwai authored
      commit bb82e0b4 upstream.
      
      The commit f6f82851 ("pstore: pass allocated memory region back to
      caller") changed the check of the return value from erst_read() in
      erst_reader() in the following way:
      
              if (len == -ENOENT)
                      goto skip;
      -       else if (len < 0) {
      -               rc = -1;
      +       else if (len < sizeof(*rcd)) {
      +               rc = -EIO;
                      goto out;
      
      This introduced another bug: since the comparison with sizeof() is
      cast to unsigned, a negative len value doesn't hit any longer.
      As a result, when an error is returned from erst_read(), the code
      falls through, and it may eventually lead to some weird thing like
      memory corruption.
      
      This patch adds the negative error value check more explicitly for
      addressing the issue.
      
      Fixes: f6f82851 (pstore: pass allocated memory region back to caller)
      Tested-by: default avatarJerry Tang <jtang@suse.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54c74d38
  2. 25 Dec, 2017 36 commits