1. 18 1月, 2023 1 次提交
    • K
      dmaengine: Fix double increment of client_count in dma_chan_get() · f3dc1b3b
      Koba Ko 提交于
      The first time dma_chan_get() is called for a channel the channel
      client_count is incorrectly incremented twice for public channels,
      first in balance_ref_count(), and again prior to returning. This
      results in an incorrect client count which will lead to the
      channel resources not being freed when they should be. A simple
       test of repeated module load and unload of async_tx on a Dell
       Power Edge R7425 also shows this resulting in a kref underflow
       warning.
      
      [  124.329662] async_tx: api initialized (async)
      [  129.000627] async_tx: api initialized (async)
      [  130.047839] ------------[ cut here ]------------
      [  130.052472] refcount_t: underflow; use-after-free.
      [  130.057279] WARNING: CPU: 3 PID: 19364 at lib/refcount.c:28
      refcount_warn_saturate+0xba/0x110
      [  130.065811] Modules linked in: async_tx(-) rfkill intel_rapl_msr
      intel_rapl_common amd64_edac edac_mce_amd ipmi_ssif kvm_amd dcdbas kvm
      mgag200 drm_shmem_helper acpi_ipmi irqbypass drm_kms_helper ipmi_si
      syscopyarea sysfillrect rapl pcspkr ipmi_devintf sysimgblt fb_sys_fops
      k10temp i2c_piix4 ipmi_msghandler acpi_power_meter acpi_cpufreq vfat
      fat drm fuse xfs libcrc32c sd_mod t10_pi sg ahci crct10dif_pclmul
      libahci crc32_pclmul crc32c_intel ghash_clmulni_intel igb megaraid_sas
      i40e libata i2c_algo_bit ccp sp5100_tco dca dm_mirror dm_region_hash
      dm_log dm_mod [last unloaded: async_tx]
      [  130.117361] CPU: 3 PID: 19364 Comm: modprobe Kdump: loaded Not
      tainted 5.14.0-185.el9.x86_64 #1
      [  130.126091] Hardware name: Dell Inc. PowerEdge R7425/02MJ3T, BIOS
      1.18.0 01/17/2022
      [  130.133806] RIP: 0010:refcount_warn_saturate+0xba/0x110
      [  130.139041] Code: 01 01 e8 6d bd 55 00 0f 0b e9 72 9d 8a 00 80 3d
      26 18 9c 01 00 75 85 48 c7 c7 f8 a3 03 9d c6 05 16 18 9c 01 01 e8 4a
      bd 55 00 <0f> 0b e9 4f 9d 8a 00 80 3d 01 18 9c 01 00 0f 85 5e ff ff ff
      48 c7
      [  130.157807] RSP: 0018:ffffbf98898afe68 EFLAGS: 00010286
      [  130.163036] RAX: 0000000000000000 RBX: ffff9da06028e598 RCX: 0000000000000000
      [  130.170172] RDX: ffff9daf9de26480 RSI: ffff9daf9de198a0 RDI: ffff9daf9de198a0
      [  130.177316] RBP: ffff9da7cddf3970 R08: 0000000000000000 R09: 00000000ffff7fff
      [  130.184459] R10: ffffbf98898afd00 R11: ffffffff9d9e8c28 R12: ffff9da7cddf1970
      [  130.191596] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [  130.198739] FS:  00007f646435c740(0000) GS:ffff9daf9de00000(0000)
      knlGS:0000000000000000
      [  130.206832] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  130.212586] CR2: 00007f6463b214f0 CR3: 00000008ab98c000 CR4: 00000000003506e0
      [  130.219729] Call Trace:
      [  130.222192]  <TASK>
      [  130.224305]  dma_chan_put+0x10d/0x110
      [  130.227988]  dmaengine_put+0x7a/0xa0
      [  130.231575]  __do_sys_delete_module.constprop.0+0x178/0x280
      [  130.237157]  ? syscall_trace_enter.constprop.0+0x145/0x1d0
      [  130.242652]  do_syscall_64+0x5c/0x90
      [  130.246240]  ? exc_page_fault+0x62/0x150
      [  130.250178]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [  130.255243] RIP: 0033:0x7f6463a3f5ab
      [  130.258830] Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48
      83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00
      00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89
      01 48
      [  130.277591] RSP: 002b:00007fff22f972c8 EFLAGS: 00000206 ORIG_RAX:
      00000000000000b0
      [  130.285164] RAX: ffffffffffffffda RBX: 000055b6786edd40 RCX: 00007f6463a3f5ab
      [  130.292303] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055b6786edda8
      [  130.299443] RBP: 000055b6786edd40 R08: 0000000000000000 R09: 0000000000000000
      [  130.306584] R10: 00007f6463b9eac0 R11: 0000000000000206 R12: 000055b6786edda8
      [  130.313731] R13: 0000000000000000 R14: 000055b6786edda8 R15: 00007fff22f995f8
      [  130.320875]  </TASK>
      [  130.323081] ---[ end trace eff7156d56b5cf25 ]---
      
      cat /sys/class/dma/dma0chan*/in_use would get the wrong result.
      2
      2
      2
      
      Fixes: d2f4f99d ("dmaengine: Rework dma_chan_get")
      Signed-off-by: NKoba Ko <koba.ko@canonical.com>
      Reviewed-by: NJie Hai <haijie1@huawei.com>
      Test-by: NJie Hai <haijie1@huawei.com>
      Reviewed-by: NJerry Snitselaar <jsnitsel@redhat.com>
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Tested-by: NJoel Savitz <jsavitz@redhat.com>
      Link: https://lore.kernel.org/r/20221201030050.978595-1-koba.ko@canonical.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
      f3dc1b3b
  2. 27 6月, 2022 1 次提交
  3. 11 4月, 2022 1 次提交
  4. 22 11月, 2021 1 次提交
  5. 18 10月, 2021 1 次提交
  6. 12 4月, 2021 1 次提交
  7. 20 1月, 2021 1 次提交
    • D
      dmaengine: move channel device_node deletion to driver · e5944431
      Dave Jiang 提交于
      Channel device_node deletion is managed by the device driver rather than
      the dmaengine core. The deletion was accidentally introduced when making
      channel unregister dynamic. It causes xilinx_dma module to crash on unload
      as reported by Radhey. Remove chan->device_node delete in dmaengine and
      also fix up idxd driver.
      
      [   42.142705] Internal error: Oops: 96000044 [#1] SMP
      [   42.147566] Modules linked in: xilinx_dma(-) clk_xlnx_clock_wizard uio_pdrv_genirq
      [   42.155139] CPU: 1 PID: 2075 Comm: rmmod Not tainted 5.10.1-00026-g3a2e6dd7a05-dirty #192
      [   42.163302] Hardware name: Enclustra XU5 SOM (DT)
      [   42.167992] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
      [   42.173996] pc : xilinx_dma_chan_remove+0x74/0xa0 [xilinx_dma]
      [   42.179815] lr : xilinx_dma_chan_remove+0x70/0xa0 [xilinx_dma]
      [   42.185636] sp : ffffffc01112bca0
      [   42.188935] x29: ffffffc01112bca0 x28: ffffff80402ea640
      
      xilinx_dma_chan_remove+0x74/0xa0:
      __list_del at ./include/linux/list.h:112 (inlined by)
      __list_del_entry at./include/linux/list.h:135 (inlined by)
      list_del at ./include/linux/list.h:146 (inlined by)
      xilinx_dma_chan_remove at drivers/dma/xilinx/xilinx_dma.c:2546
      
      Fixes: e81274cd ("dmaengine: add support to dynamic register/unregister of channels")
      Reported-by: NRadhey Shyam Pandey <radheys@xilinx.com>
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      Tested-by: NRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
      Link: https://lore.kernel.org/r/161099092469.2495902.5064826526660062342.stgit@djiang5-desk3.ch.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
      Cc: stable@vger.kernel.org # 5.9+
      e5944431
  8. 18 11月, 2020 1 次提交
  9. 03 9月, 2020 2 次提交
  10. 27 7月, 2020 3 次提交
  11. 04 5月, 2020 2 次提交
    • A
      dmaengine: Fix doc strings to satisfy validation script · 9872e23d
      Andy Shevchenko 提交于
      The validation kernel doc script complains about undescribed
      function parameters
      
      .../dmaengine.c:155: warning: Function parameter or member 'dev' not descr ibed in 'dev_to_dma_chan'
      .../dmaengine.c:251: warning: cannot understand function prototype: 'dma_cap_mask_t dma_cap_mask_all; '
      .../dmaengine.c:257: warning: cannot understand function prototype: 'struct dma_chan_tbl_ent '
      .../dmaengine.c:264: warning: cannot understand function prototype: 'struct dma_chan_tbl_ent __percpu *channel_table[DMA_TX_TYPE_END]; '
      .../dmaengine.c:304: warning: Function parameter or member 'chan' not described in 'dma_chan_is_local'
      .../dmaengine.c:304: warning: Function parameter or member 'cpu' not described in 'dma_chan_is_local'
      .../dmaengine.c:414: warning: Function parameter or member 'chan' not described in 'balance_ref_count'
      .../dmaengine.c:447: warning: Function parameter or member 'chan' not described in 'dma_chan_get'
      .../dmaengine.c:494: warning: Function parameter or member 'chan' not described in 'dma_chan_put'
      
      Add descriptions to the function parameters and in some cases update
      existing text as well.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20200429122151.50989-2-andriy.shevchenko@linux.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
      9872e23d
    • A
      dmaengine: Include dmaengine.h into dmaengine.c · 833d88f3
      Andy Shevchenko 提交于
      Compiler is not happy about non-static functions due to missed inclusion
      
      .../dmaengine.c:682:18: warning: no previous prototype for ‘dma_get_slave_channel’ [-Wmissing-prototypes]
        682 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
            |                  ^~~~~~~~~~~~~~~~~~~~~
      .../dmaengine.c:713:18: warning: no previous prototype for ‘dma_get_any_slave_channel’ [-Wmissing-prototypes]
        713 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
            |                  ^~~~~~~~~~~~~~~~~~~~~~~~~
      
      Include missed header to satisfy compiler.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20200429122151.50989-1-andriy.shevchenko@linux.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
      833d88f3
  12. 27 4月, 2020 1 次提交
  13. 11 3月, 2020 3 次提交
  14. 03 2月, 2020 2 次提交
  15. 30 1月, 2020 1 次提交
  16. 24 1月, 2020 3 次提交
  17. 21 1月, 2020 2 次提交
  18. 26 12月, 2019 2 次提交
  19. 24 12月, 2019 4 次提交
  20. 10 6月, 2019 1 次提交
  21. 27 5月, 2019 1 次提交
  22. 21 5月, 2019 1 次提交
  23. 06 3月, 2019 1 次提交
    • A
      mm: replace all open encodings for NUMA_NO_NODE · 98fa15f3
      Anshuman Khandual 提交于
      Patch series "Replace all open encodings for NUMA_NO_NODE", v3.
      
      All these places for replacement were found by running the following
      grep patterns on the entire kernel code.  Please let me know if this
      might have missed some instances.  This might also have replaced some
      false positives.  I will appreciate suggestions, inputs and review.
      
      1. git grep "nid == -1"
      2. git grep "node == -1"
      3. git grep "nid = -1"
      4. git grep "node = -1"
      
      This patch (of 2):
      
      At present there are multiple places where invalid node number is
      encoded as -1.  Even though implicitly understood it is always better to
      have macros in there.  Replace these open encodings for an invalid node
      number with the global macro NUMA_NO_NODE.  This helps remove NUMA
      related assumptions like 'invalid node' from various places redirecting
      them to a common definition.
      
      Link: http://lkml.kernel.org/r/1545127933-10711-2-git-send-email-anshuman.khandual@arm.comSigned-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>	[ixgbe]
      Acked-by: Jens Axboe <axboe@kernel.dk>			[mtip32xx]
      Acked-by: Vinod Koul <vkoul@kernel.org>			[dmaengine.c]
      Acked-by: Michael Ellerman <mpe@ellerman.id.au>		[powerpc]
      Acked-by: Doug Ledford <dledford@redhat.com>		[drivers/infiniband]
      Cc: Joseph Qi <jiangqi903@gmail.com>
      Cc: Hans Verkuil <hverkuil@xs4all.nl>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      98fa15f3
  24. 22 8月, 2018 1 次提交
  25. 30 7月, 2018 1 次提交
  26. 25 7月, 2018 1 次提交