1. 27 6月, 2022 3 次提交
  2. 10 6月, 2022 1 次提交
    • D
      spi: Fix per-cpu stats access on 32 bit systems · 67b9d641
      David Jander 提交于
      On 32 bit systems, the following kernel BUG is hit:
      
      BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
      caller is debug_smp_processor_id+0x18/0x24
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc1-00001-g6ae0aec8a366 #181
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
       dump_backtrace from show_stack+0x20/0x24
       r7:81024ffd r6:00000000 r5:81024ffd r4:60000013
       show_stack from dump_stack_lvl+0x60/0x78
       dump_stack_lvl from dump_stack+0x14/0x1c
       r7:81024ffd r6:80f652de r5:80bec180 r4:819a2500
       dump_stack from check_preemption_disabled+0xc8/0xf0
       check_preemption_disabled from debug_smp_processor_id+0x18/0x24
       r8:8119b7e0 r7:81205534 r6:819f5c00 r5:819f4c00 r4:c083d724
       debug_smp_processor_id from __spi_sync+0x78/0x220
       __spi_sync from spi_sync+0x34/0x4c
       r10:bb7bf4e0 r9:c083d724 r8:00000007 r7:81a068c0 r6:822a83c0 r5:c083d724
       r4:819f4c00
       spi_sync from spi_mem_exec_op+0x338/0x370
       r5:000000b4 r4:c083d910
       spi_mem_exec_op from spi_nor_read_id+0x98/0xdc
       r10:bb7bf4e0 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:82358040
       r4:819f7c40
       spi_nor_read_id from spi_nor_detect+0x38/0x114
       r7:82358040 r6:00000000 r5:819f7c40 r4:819f7c40
       spi_nor_detect from spi_nor_scan+0x11c/0xbec
       r10:bb7bf4e0 r9:00000000 r8:00000000 r7:c083da4c r6:00000000 r5:00010101
       r4:819f7c40
       spi_nor_scan from spi_nor_probe+0x10c/0x2d0
       r10:bb7bf4e0 r9:bb7bf4d0 r8:00000000 r7:819f4c00 r6:00000000 r5:00000000
       r4:819f7c40
      
      per-cpu access needs to be guarded against preemption.
      
      Fixes: 6598b91b ("spi: spi.c: Convert statistics to per-cpu u64_stats_t")
      Reported-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NDavid Jander <david@protonic.nl>
      Tested-by: NNícolas F. R. A. Prado <nfraprado@collabora.com>
      Link: https://lore.kernel.org/r/20220609121334.2984808-1-david@protonic.nlSigned-off-by: NMark Brown <broonie@kernel.org>
      67b9d641
  3. 09 6月, 2022 1 次提交
  4. 06 6月, 2022 2 次提交
  5. 12 5月, 2022 1 次提交
  6. 22 4月, 2022 1 次提交
  7. 28 2月, 2022 1 次提交
  8. 14 2月, 2022 1 次提交
  9. 10 2月, 2022 1 次提交
  10. 09 2月, 2022 1 次提交
  11. 02 2月, 2022 8 次提交
  12. 08 1月, 2022 1 次提交
  13. 14 10月, 2021 1 次提交
    • M
      spi: Fix deadlock when adding SPI controllers on SPI buses · 6098475d
      Mark Brown 提交于
      Currently we have a global spi_add_lock which we take when adding new
      devices so that we can check that we're not trying to reuse a chip
      select that's already controlled.  This means that if the SPI device is
      itself a SPI controller and triggers the instantiation of further SPI
      devices we trigger a deadlock as we try to register and instantiate
      those devices while in the process of doing so for the parent controller
      and hence already holding the global spi_add_lock.  Since we only care
      about concurrency within a single SPI bus move the lock to be per
      controller, avoiding the deadlock.
      
      This can be easily triggered in the case of spi-mux.
      Reported-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6098475d
  14. 07 10月, 2021 2 次提交
  15. 05 8月, 2021 2 次提交
  16. 12 7月, 2021 1 次提交
  17. 25 6月, 2021 1 次提交
  18. 22 6月, 2021 1 次提交
  19. 09 6月, 2021 1 次提交
  20. 11 5月, 2021 1 次提交
  21. 08 4月, 2021 1 次提交
    • W
      spi: Fix use-after-free with devm_spi_alloc_* · 794aaf01
      William A. Kennington III 提交于
      We can't rely on the contents of the devres list during
      spi_unregister_controller(), as the list is already torn down at the
      time we perform devres_find() for devm_spi_release_controller. This
      causes devices registered with devm_spi_alloc_{master,slave}() to be
      mistakenly identified as legacy, non-devm managed devices and have their
      reference counters decremented below 0.
      
      ------------[ cut here ]------------
      WARNING: CPU: 1 PID: 660 at lib/refcount.c:28 refcount_warn_saturate+0x108/0x174
      [<b0396f04>] (refcount_warn_saturate) from [<b03c56a4>] (kobject_put+0x90/0x98)
      [<b03c5614>] (kobject_put) from [<b0447b4c>] (put_device+0x20/0x24)
       r4:b6700140
      [<b0447b2c>] (put_device) from [<b07515e8>] (devm_spi_release_controller+0x3c/0x40)
      [<b07515ac>] (devm_spi_release_controller) from [<b045343c>] (release_nodes+0x84/0xc4)
       r5:b6700180 r4:b6700100
      [<b04533b8>] (release_nodes) from [<b0454160>] (devres_release_all+0x5c/0x60)
       r8:b1638c54 r7:b117ad94 r6:b1638c10 r5:b117ad94 r4:b163dc10
      [<b0454104>] (devres_release_all) from [<b044e41c>] (__device_release_driver+0x144/0x1ec)
       r5:b117ad94 r4:b163dc10
      [<b044e2d8>] (__device_release_driver) from [<b044f70c>] (device_driver_detach+0x84/0xa0)
       r9:00000000 r8:00000000 r7:b117ad94 r6:b163dc54 r5:b1638c10 r4:b163dc10
      [<b044f688>] (device_driver_detach) from [<b044d274>] (unbind_store+0xe4/0xf8)
      
      Instead, determine the devm allocation state as a flag on the
      controller which is guaranteed to be stable during cleanup.
      
      Fixes: 5e844cc3 ("spi: Introduce device-managed SPI controller allocation")
      Signed-off-by: NWilliam A. Kennington III <wak@google.com>
      Link: https://lore.kernel.org/r/20210407095527.2771582-1-wak@google.comSigned-off-by: NMark Brown <broonie@kernel.org>
      794aaf01
  22. 01 4月, 2021 1 次提交
  23. 16 3月, 2021 2 次提交
  24. 12 3月, 2021 1 次提交
  25. 08 2月, 2021 1 次提交
  26. 06 1月, 2021 1 次提交
  27. 28 12月, 2020 1 次提交