1. 07 12月, 2018 9 次提交
    • I
      nvmet-rdma: fix response use after free · d7dcdf9d
      Israel Rukshin 提交于
      nvmet_rdma_release_rsp() may free the response before using it at error
      flow.
      
      Fixes: 8407879c ("nvmet-rdma: fix possible bogus dereference under heavy load")
      Signed-off-by: NIsrael Rukshin <israelr@mellanox.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: NMax Gurtovoy <maxg@mellanox.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      d7dcdf9d
    • J
      nvme: validate controller state before rescheduling keep alive · 86880d64
      James Smart 提交于
      Delete operations are seeing NULL pointer references in call_timer_fn.
      Tracking these back, the timer appears to be the keep alive timer.
      
      nvme_keep_alive_work() which is tied to the timer that is cancelled
      by nvme_stop_keep_alive(), simply starts the keep alive io but doesn't
      wait for it's completion. So nvme_stop_keep_alive() only stops a timer
      when it's pending. When a keep alive is in flight, there is no timer
      running and the nvme_stop_keep_alive() will have no affect on the keep
      alive io. Thus, if the io completes successfully, the keep alive timer
      will be rescheduled.   In the failure case, delete is called, the
      controller state is changed, the nvme_stop_keep_alive() is called while
      the io is outstanding, and the delete path continues on. The keep
      alive happens to successfully complete before the delete paths mark it
      as aborted as part of the queue termination, so the timer is restarted.
      The delete paths then tear down the controller, and later on the timer
      code fires and the timer entry is now corrupt.
      
      Fix by validating the controller state before rescheduling the keep
      alive. Testing with the fix has confirmed the condition above was hit.
      Signed-off-by: NJames Smart <jsmart2021@gmail.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      86880d64
    • M
      i2c: uniphier-f: fix violation of tLOW requirement for Fast-mode · ece27a33
      Masahiro Yamada 提交于
      Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode,
      tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us.
      
      tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode:
        Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us
        Fast-mode:     tLOW = 1.39 us, tHIGH = 1.11 us
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      ece27a33
    • M
      i2c: uniphier: fix violation of tLOW requirement for Fast-mode · 8469636a
      Masahiro Yamada 提交于
      Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode,
      tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us.
      
      tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode:
        Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us
        Fast-mode:     tLOW = 1.39 us, tHIGH = 1.11 us
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      8469636a
    • M
      i2c: uniphier-f: fill TX-FIFO only in IRQ handler for repeated START · cd8843f5
      Masahiro Yamada 提交于
      - For a repeated START condition, this controller starts data transfer
         immediately after the slave address is written to the TX-FIFO.
      
       - Once the TX-FIFO empty interrupt is asserted, the controller makes
         a pause even if additional data are written to the TX-FIFO.
      
      Given those circumstances, the data after a repeated START may not be
      transferred if the interrupt is asserted while the TX-FIFO is being
      filled up. A more reliable way is to append TX data only in the
      interrupt handler.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      cd8843f5
    • M
      i2c: uniphier-f: fix timeout error after reading 8 bytes · c2a653de
      Masahiro Yamada 提交于
      I was totally screwed up in commit eaba6878 ("i2c: uniphier-f:
      fix race condition when IRQ is cleared"). Since that commit, if the
      number of read bytes is multiple of the FIFO size (8, 16, 24... bytes),
      the STOP condition could be issued twice, depending on the timing.
      If this happens, the controller will go wrong, resulting in the timeout
      error.
      
      It was more than 3 years ago when I wrote this driver, so my memory
      about this hardware was vague. Please let me correct the description
      in the commit log of eaba6878.
      
      Clearing the IRQ status on exiting the IRQ handler is absolutely
      fine. This controller makes a pause while any IRQ status is asserted.
      If the IRQ status is cleared first, the hardware may start the next
      transaction before the IRQ handler finishes what it supposed to do.
      
      This partially reverts the bad commit with clear comments so that I
      will never repeat this mistake.
      
      I also investigated what is happening at the last moment of the read
      mode. The UNIPHIER_FI2C_INT_RF interrupt is asserted a bit earlier
      (by half a period of the clock cycle) than UNIPHIER_FI2C_INT_RB.
      
      I consulted a hardware engineer, and I got the following information:
      
      UNIPHIER_FI2C_INT_RF
          asserted at the falling edge of SCL at the 8th bit.
      
      UNIPHIER_FI2C_INT_RB
          asserted at the rising edge of SCL at the 9th (ACK) bit.
      
      In order to avoid calling uniphier_fi2c_stop() twice, check the latter
      interrupt. I also commented this because it is obscure hardware internal.
      
      Fixes: eaba6878 ("i2c: uniphier-f: fix race condition when IRQ is cleared")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      c2a653de
    • H
      i2c: scmi: Fix probe error on devices with an empty SMB0001 ACPI device node · 0544ee4b
      Hans de Goede 提交于
      Some AMD based HP laptops have a SMB0001 ACPI device node which does not
      define any methods.
      
      This leads to the following error in dmesg:
      
      [    5.222731] cmi: probe of SMB0001:00 failed with error -5
      
      This commit makes acpi_smbus_cmi_add() return -ENODEV instead in this case
      silencing the error. In case of a failure of the i2c_add_adapter() call
      this commit now propagates the error from that call instead of -EIO.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      0544ee4b
    • A
      i2c: axxia: properly handle master timeout · 6c7f25ca
      Adamski, Krzysztof (Nokia - PL/Wroclaw) 提交于
      According to Intel (R) Axxia TM Lionfish Communication Processor
      Peripheral Subsystem Hardware Reference Manual, the AXXIA I2C module
      have a programmable Master Wait Timer, which among others, checks the
      time between commands send in manual mode. When a timeout (25ms) passes,
      TSS bit is set in Master Interrupt Status register and a Stop command is
      issued by the hardware.
      
      The axxia_i2c_xfer(), does not properly handle this situation, however.
      For each message a separate axxia_i2c_xfer_msg() is called and this
      function incorrectly assumes that any interrupt might happen only when
      waiting for completion. This is mostly correct but there is one
      exception - a master timeout can trigger if enough time has passed
      between individual transfers. It will, by definition, happen between
      transfers when the interrupts are disabled by the code. If that happens,
      the hardware issues Stop command.
      
      The interrupt indicating timeout will not be triggered as soon as we
      enable them since the Master Interrupt Status is cleared when master
      mode is entered again (which happens before enabling irqs) meaning this
      error is lost and the transfer is continued even though the Stop was
      issued on the bus. The subsequent operations completes without error but
      a bogus value (0xFF in case of read) is read as the client device is
      confused because aborted transfer. No error is returned from
      master_xfer() making caller believe that a valid value was read.
      
      To fix the problem, the TSS bit (indicating timeout) in Master Interrupt
      Status register is checked before each transfer. If it is set, there was
      a timeout before this transfer and (as described above) the hardware
      already issued Stop command so the transaction should be aborted thus
      -ETIMEOUT is returned from the master_xfer() callback. In order to be
      sure no timeout was issued we can't just read the status just before
      starting new transaction as there will always be a small window of time
      (few CPU cycles at best) where this might still happen. For this reason
      we have to temporally disable the timer before checking for TSS bit.
      Disabling it will, however, clear the TSS bit so in order to preserve
      that information, we have to read it in ISR so we have to ensure that
      the TSS interrupt is not masked between transfers of one transaction.
      There is no need to call bus recovery or controller reinitialization if
      that happens so it's skipped.
      Signed-off-by: NKrzysztof Adamski <krzysztof.adamski@nokia.com>
      Reviewed-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      6c7f25ca
    • A
      dmaengine: dw: Fix FIFO size for Intel Merrifield · ffe843b1
      Andy Shevchenko 提交于
      Intel Merrifield has a reduced size of FIFO used in iDMA 32-bit controller,
      i.e. 512 bytes instead of 1024.
      
      Fix this by partitioning it as 64 bytes per channel.
      
      Note, in the future we might switch to 'fifo-size' property instead of
      hard coded value.
      
      Fixes: 199244d6 ("dmaengine: dw: add support of iDMA 32-bit hardware")
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      ffe843b1
  2. 06 12月, 2018 2 次提交
  3. 05 12月, 2018 9 次提交
    • E
      Revert "mfd: cros_ec: Use devm_kzalloc for private data" · 48a2ca0e
      Enric Balletbo i Serra 提交于
      This reverts commit 3aa2177e.
      
      That commit triggered a new WARN when unloading the module (see at the
      end of the commit message). When a class_dev is embedded in a structure
      then that class_dev is the thing that controls the lifetime of that
      structure, for that reason device managed allocations can't be used here.
      See Documentation/kobject.txt.
      
      Revert the above patch, so the struct is allocated using kzalloc and we
      have a release function for it that frees the allocated memory, otherwise
      it is broken.
      
       ------------[ cut here ]------------
       Device 'cros_ec' does not have a release() function, it is broken and must be fixed.
       WARNING: CPU: 3 PID: 3675 at drivers/base/core.c:895 device_release+0x80/0x90
       Modules linked in: btusb btrtl btintel btbcm bluetooth ...
       CPU: 3 PID: 3675 Comm: rmmod Not tainted 4.20.0-rc4 #76
       Hardware name: Google Kevin (DT)
       pstate: 40000005 (nZcv daif -PAN -UAO)
       pc : device_release+0x80/0x90
       lr : device_release+0x80/0x90
       sp : ffff00000c47bc70
       x29: ffff00000c47bc70 x28: ffff8000e86b0d40
       x27: 0000000000000000 x26: 0000000000000000
       x25: 0000000056000000 x24: 0000000000000015
       x23: ffff8000f0bbf860 x22: ffff000000d320a0
       x21: ffff8000ee93e100 x20: ffff8000ed931428
       x19: ffff8000ed931418 x18: 0000000000000020
       x17: 0000000000000000 x16: 0000000000000000
       x15: 0000000000000400 x14: 0000000000000143
       x13: 0000000000000000 x12: 0000000000000400
       x11: 0000000000000157 x10: 0000000000000960
       x9 : ffff00000c47b9b0 x8 : ffff8000e86b1700
       x7 : 0000000000000000 x6 : ffff8000f7d520b8
       x5 : ffff8000f7d520b8 x4 : 0000000000000000
       x3 : ffff8000f7d58e68 x2 : ffff8000e86b0d40
       x1 : 37d859939c964800 x0 : 0000000000000000
       Call trace:
        device_release+0x80/0x90
        kobject_put+0x74/0xe8
        device_unregister+0x20/0x30
        ec_device_remove+0x34/0x48 [cros_ec_dev]
        platform_drv_remove+0x28/0x48
        device_release_driver_internal+0x1a8/0x240
        driver_detach+0x40/0x80
        bus_remove_driver+0x54/0xa8
        driver_unregister+0x2c/0x58
        platform_driver_unregister+0x10/0x18
        cros_ec_dev_exit+0x1c/0x2d8 [cros_ec_dev]
        __arm64_sys_delete_module+0x16c/0x1f8
        el0_svc_common+0x84/0xd8
        el0_svc_handler+0x2c/0x80
        el0_svc+0x8/0xc
       ---[ end trace a57c4625f3c60ae8 ]---
      
      Cc: stable@vger.kernel.org
      Fixes: 3aa2177e ("mfd: cros_ec: Use devm_kzalloc for private data")
      Signed-off-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Reviewed-by: NGuenter Roeck <groeck@chromium.org>
      Reviewed-by: NDmitry Torokhov <dtor@chromium.org>
      Signed-off-by: NLee Jones <lee.jones@linaro.org>
      48a2ca0e
    • B
      dmaengine: cppi41: delete channel from pending list when stop channel · 59861547
      Bin Liu 提交于
      The driver defines three states for a cppi channel.
      - idle: .chan_busy == 0 && not in .pending list
      - pending: .chan_busy == 0 && in .pending list
      - busy: .chan_busy == 1 && not in .pending list
      
      There are cases in which the cppi channel could be in the pending state
      when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
      is called.
      
      cppi41_stop_chan() has a bug for these cases to set channels to idle state.
      It only checks the .chan_busy flag, but not the .pending list, then later
      when cppi41_runtime_resume() is called the channels in .pending list will
      be transitioned to busy state.
      
      Removing channels from the .pending list solves the problem.
      
      Fixes: 975faaeb ("dma: cppi41: start tear down only if channel is busy")
      Cc: stable@vger.kernel.org # v3.15+
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Reviewed-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      59861547
    • L
      dmaengine: imx-sdma: use GFP_NOWAIT for dma descriptor allocations · 64068853
      Lucas Stach 提交于
      DMA buffer descriptors aren't allocated from atomic context, so they
      can use the less heavyweigth GFP_NOWAIT.
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      64068853
    • L
      dmaengine: imx-sdma: implement channel termination via worker · b8603d2a
      Lucas Stach 提交于
      The dmaengine documentation states that device_terminate_all may be
      asynchronous and need not wait for the active transfers to stop.
      
      This allows us to move most of the functionality currently implemented
      in the sdma channel termination function to run in a worker, outside
      of any atomic context. Moving this out of atomic context has two
      benefits: we can now sleep while waiting for the channel to terminate,
      instead of busy waiting and the freeing of the dma descriptors happens
      with IRQs enabled, getting rid of a warning in the dma mapping code.
      
      As the termination is now async, we need to implement the
      device_synchronize dma engine function which simply waits for the
      worker to finish its execution.
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      b8603d2a
    • L
      Revert "dmaengine: imx-sdma: alloclate bd memory from dma pool" · ebb853b1
      Lucas Stach 提交于
      This reverts commit fe5b85c6. The SDMA engine needs the descriptors to
      be contiguous in memory. As the dma pool API is only able to provide a
      single descriptor per alloc invocation there is no guarantee that multiple
      descriptors satisfy this requirement. Also the code in question is broken
      as it only allocates memory for a single descriptor, without looking at the
      number of descriptors required for the transfer, leading to out-of-bounds
      accesses when the descriptors are written.
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      ebb853b1
    • L
      Revert "dmaengine: imx-sdma: Use GFP_NOWAIT for dma allocations" · c06abca6
      Lucas Stach 提交于
      This reverts commit c1199875, as this depends on another commit
      that is going to be reverted.
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: NRobin Gong <yibin.gong@nxp.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      c06abca6
    • N
      drm/amd/display: Fix overflow/truncation from strncpy. · 090afc1e
      Nicholas Kazlauskas 提交于
      [Why]
      
      New GCC warnings for stringop-truncation and stringop-overflow help
      catch common misuse of strncpy. This patch suppresses these warnings
      by fixing bugs identified by them.
      
      [How]
      
      Since the parameter passed for name in amdpgu_dm_create_common_mode has
      no fixed length, if the string is >= DRM_DISPLAY_MODE_LEN then
      mode->name will not be null-terminated.
      
      The truncation in fill_audio_info won't actually occur (and the string
      will be null-terminated since the buffer is initialized to zero), but
      the warning can be suppressed by using the proper buffer size.
      
      This patch fixes both issues by using the real size for the buffer and
      making use of strscpy (which always terminates).
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      090afc1e
    • T
      drm/amd/powerplay: improve OD code robustness · 1b3b27b2
      tianci yin 提交于
      add protection code to avoid lower frequency trigger over drive.
      Reviewed-by: NRex Zhu <Rex.Zhu@amd.com>
      Signed-off-by: NTianci Yin <tianci.yin@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      1b3b27b2
    • W
      drm/amdgpu: enlarge maximum waiting time of KIQ · 4944af67
      wentalou 提交于
      KIQ in VF’s init delayed by another VF’s reset,
      which would cause late_init failed occasionally.
      MAX_KIQ_REG_TRY enlarged from 20 to 80 would fix this issue.
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NWentao Lou <Wentao.Lou@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      4944af67
  4. 04 12月, 2018 13 次提交
  5. 03 12月, 2018 7 次提交