summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2026-10-05drm/msm/a6xx: check pm_runtime_resume_and_get during resumeRoman Demidov
The return values of pm_runtime_resume_and_get() calls in a6xx_pm_resume() are not checked, which can lead to hardware access on suspended devices and PM reference underflows. Fix this by checking the return value of each pm_runtime_resume_and_get() call and properly unwinding the previously acquired resources on failure. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 5a903a44a984 ("drm/msm/a6xx: Introduce GMU wrapper support") Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/757106/ Message-ID: <20260929142103.81854-2-roman.demidov.nn@gmail.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
2026-10-05drm/msm/a6xx: fix use-after-free of OPP in a6xx_pm_resumeRoman Demidov
The OPP reference obtained via dev_pm_opp_find_freq_ceil() is dropped with dev_pm_opp_put() before being passed to dev_pm_opp_set_opp(). If the reference count reaches zero, the OPP object may be freed, leading to a use-after-free when dev_pm_opp_set_opp() dereferences it. Fix the order of calls: first use the OPP to set the required performance state, then release the reference. Fixes: 5a903a44a984 ("drm/msm/a6xx: Introduce GMU wrapper support") Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/757104/ Message-ID: <20260929142103.81854-1-roman.demidov.nn@gmail.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
2026-10-05wifi: ath10k: clear QMI if failed during initAlbert Esteve
A failed ath10k_qmi_init() leaves a dangling pointer (ar_snoc->qmi) in the cleanup path. Clear the pointer on the way out for hygiene and consistency with deinit(). Signed-off-by: Albert Esteve <aesteve@redhat.com> Reviewed-by: Brian Norris <briannorris@chromium.org> Link: https://patch.msgid.link/20260914-fix-ath10k-dangling-v1-1-15c5089682b1@redhat.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
2026-10-05wifi: ath9k: refuse spectral scan control while the hardware is disabledNerijus Bendžiūnas
The spectral_scan_ctl debugfs file drives PHY register writes, and nothing checks whether the hardware is up. While the interface is down the chip is asleep, and on the AR9271 those writes go over WMI to a sleeping target and hang the firmware until the device is re-enumerated. Refuse the write with -EBUSY while ATH_OP_INVALID is set. The reset control already refuses on the same flag. Assisted-by: LLM Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Link: https://patch.msgid.link/20260908180308.788642-1-nerijus.bendziunas@gmail.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
2026-10-05wifi: ath9k: delete channel-context timers on deinitRosen Penev
ath9k_deinit_channel_context() cancels chanctx_work but does not delete the offchannel and sched timers set up by ath9k_init_channel_context(). If either timer fires after deinit (e.g. during driver unload or suspend), it accesses sc->sc_ah which may already be freed by ath9k_hw_deinit(), causing a use-after-free. Delete both timers with timer_shutdown_sync() before cancelling the work item. Assisted-by: LLM Signed-off-by: Rosen Penev <rosenp@gmail.com> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Cc: stable@vger.kernel.org # v6.2+ Fixes: 705d0bf83dbe ("ath9k: Add a routine for initializing channel contexts") Link: https://patch.msgid.link/20260911213144.130192-1-rosenp@gmail.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
2026-10-05wifi: ath12k: Reserve space for a string terminatorJiale Yao
ath12k_write_htt_stats_type() accepts count == size, which fills the zero-initialized buffer without a terminating NUL. sscanf() then reads beyond the buffer. Reject input that leaves no room for the trailing NUL. Fixes: 8c7a5031a6b0 ("wifi: ath12k: Fix buffer overflow in debugfs") Reviewed-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Signed-off-by: Jiale Yao <yaojiale02@163.com> Link: https://patch.msgid.link/20261003095913.575108-1-yaojiale02@163.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
2026-10-05wifi: ath11k: fix unbalanced IRQ enable/disable during suspend/resumeBaochen Qiang
Commit f7a74e131d3f ("wifi: ath11k: disable interrupts during firmware crash recovery") added an unconditional ath11k_hif_irq_disable()/ ath11k_hif_ce_irq_disable() pair inside ath11k_core_reconfigure_on_crash(), guarded by "if (!ab->is_reset)", to stop the DP NAPI from touching rings that have just been torn down. That fixes AHB device recovery, but breaks PCI device suspend/resume. During suspend, IRQs are disabled once in ath11k_core_suspend_late(). Then during resume, ath11k_core_reconfigure_on_crash() sees ab->is_reset clear and disables them a second time. Those IRQs are enabled only once during the following reinitialization, leaving the IRQ lines masked. As a result, HTC control responses never arrive, and resume fails: failed to receive control response completion, polling.. failed to connect to HTT: -110 failed to reconfigure driver on crash recovery failed to resume core: -110 Fix this by disabling the IRQs unconditionally at the top of ath11k_core_reconfigure_on_crash(), and instead drop the disable calls from the two places that already disable IRQs before this function can run: ath11k_core_suspend_late() and ath11k_core_reset(). This keeps a single disable per recovery/suspend cycle regardless of which path (recovery or suspend) triggers it, so the refcount on PCI parts stays balanced while AHB parts keep getting the disable that the original commit needed. Fixes: f7a74e131d3f ("wifi: ath11k: disable interrupts during firmware crash recovery") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Closes: https://lore.kernel.org/linux-wireless/a068a857-a549-4cc2-ae0f-3ef119d3a859@samsung.com/ Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Julius Bairaktaris <julius@bairaktaris.de> Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com> Link: https://patch.msgid.link/20260928-ath11k-unbalanced-irq-enable-disable-v1-1-75166f534763@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
2026-10-05Merge tag 'nxpwifi-next-20260929-v3' of ↵Johannes Berg
https://github.com/nxp-upstream/nxpwifi-next Jeff Chen says: =============== nxpwifi patches for Linux v7.4 (PR #1) - Add IW610 SDIO support - Fix error handling issues - Add bounds checking for debugfs output - Validate variable-length IE parsing =============== Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-05PCI: Add device-specific reset for Qualcomm SDX62/SDX65 modemsJose Ignacio Tornos Martinez
Qualcomm SDX62/SDX65 5G modems (17cb:0308) lack working reset methods for VFIO passthrough scenarios. These devices have no FLR capability, advertise NoSoftRst+ (blocking PM reset), and have broken bus reset. Standard reset methods were already disabled for these devices by commit 6a4f64c3a3ad ("PCI: Avoid SBR for Qualcomm WCN6855/WCN7850 WiFi, SDX62/SDX65 modems") because they were not working (quirk_no_bus_reset). VFIO attempts to reset devices on every reassignment. Without a proper reset capability, these devices never successfully initialize even on first VM assignment. Add a device-specific reset method using BAR-space hardware reset registers that exist in these devices. SDX62/SDX65 modem devices use MHI SoC reset via BAR0 (sequence from MHI driver: mhi_soc_reset(), mhi_pci_reset_prepare()): - Write reset request to offset 0xb0 - Wait 2 seconds for reset completion These are true hardware reset mechanisms (not power management or firmware error recovery), providing proper device reset for VFIO scenarios, allowing to enforce isolation between successive passthrough users. Testing shows stable operation over 109 VM crash/reset cycles. Device- specific reset is position #1 in the reset hierarchy, so these Qualcomm devices will use hardware reset as their primary reset method. Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Acked-by: Alex Williamson <alex@shazbot.org> Link: https://patch.msgid.link/20261005105436.83962-2-jtornosm@redhat.com
2026-10-05floppy: return the drive state flags from the 32-bit FDGETDRVSTATDenis Efremov (Oracle)
compat_getdrvstat() copies every field of the drive state to a 32-bit caller except ->flags, which stays zero. 32-bit FDGETDRVSTAT and FDPOLLDRVSTAT therefore never report FD_DISK_WRITABLE, FD_DISK_CHANGED or FD_VERIFY: i386 fdutils (floppycontrol -P, fdmount), and other 32-bit users see every disk as write-protected and never see a disk change. The compat code in block/compat_ioctl.c copied the field; it was lost when that code moved into floppy.c Also declare the field as compat_ulong_t: the 32-bit struct floppy_drive_struct starts with an unsigned long, and a signed char at offset 0 only lines up with its low byte on little-endian machines. The size and offsets of the compat structure, and so FDGETDRVSTAT32, do not change. Cc: stable@vger.kernel.org Fixes: 229b53c9bf4e ("take floppy compat ioctls to sodding floppy.c") Link: https://patch.msgid.link/20260924112825.3525931-1-efremov@linux.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05floppy: don't store a stack buffer in timeout_messageDenis Efremov (Oracle)
request_done() formats "request done %d" into a buffer on its stack and passes it to reschedule_timeout(), which keeps the pointer in timeout_message. show_floppy() prints timeout_message long after request_done() has returned, e.g. from result() in the interrupt handler, and reads a dead stack frame: BUG: KASAN: stack-out-of-bounds in string+0x39c/0x3d0 lib/vsprintf.c:720 Read of size 1 at addr ffffc900003cfc70 by task swapper/3/0 Call Trace: <IRQ> ... show_floppy+0xb1/0x45f drivers/block/floppy.c:1838 result.cold+0x2b/0x30 drivers/block/floppy.c:1183 floppy_interrupt+0x191/0x340 drivers/block/floppy.c:1755 floppy_hardint+0x1a7/0x200 arch/x86/include/asm/floppy.h:66 uptodate is either 0 or 1, so pass one of two string literals instead. Cc: stable@vger.kernel.org Fixes: 73507e6cd8dc ("drivers/block/floppy.c: remove unnecessary argument from [__]reschedule_timeout") Reported-by: syzbot+874c2707f97fac24b090@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=874c2707f97fac24b090 Link: https://patch.msgid.link/20260924094839.3239569-1-efremov@linux.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05floppy: annotate data-races around command_status and floppy_work_fnCen Zhang
command_status is accessed by multiple contexts: - generic_done() and do_wakeup() write it from the floppy workqueue context. - wait_til_done() reads it in wait_event conditions without holding fdc_busy. - is_alive() reads it locklessly to check driver liveness. - floppy_queue_rq(), lock_fdc(), and unlock_fdc() write it during FDC ownership transitions. There is currently no LKMM annotation for these concurrent accesses since command_status relies on the deprecated volatile qualifier. Remove volatile and use READ_ONCE()/WRITE_ONCE() on every access to command_status to provide proper LKMM data-race annotations. Also annotate floppy_work_fn with WRITE_ONCE() in schedule_bh() and READ_ONCE() in floppy_work_workfn(), and current_type[drive] with READ_ONCE() in drive_no_geom() where it can be read without holding the FDC lock. The races were found by our tools: 1) command_status: generic_done (write) vs wait_til_done (read) ============ DATARACE ============ Function: generic_done+0x54/0xa0 drivers/block/floppy.c:985 Function: success_and_wakeup+0xeb/0x1e0 drivers/block/floppy.c:2046 Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046 Function: floppy_ready+0x2630/0x4000 Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 ============OTHER_INFO============ Function: wait_til_done+0x134/0x740 drivers/block/floppy.c:2026 Function: poll_drive+0x1fa/0x2a0 Function: fd_ioctl+0x13c8/0x1da0 drivers/block/floppy.c:3873 Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705 Function: vfs_ioctl fs/ioctl.c:51 [inline] Function: __do_sys_ioctl fs/ioctl.c:598 [inline] Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584 =================END============== 2) current_type[drive]: drive_no_geom (read) vs set_geometry (write) ============ DATARACE ============ Function: drive_no_geom drivers/block/floppy.c:606 [inline] Function: floppy_check_events+0x9c9/0xcf0 drivers/block/floppy.c:4187 Function: disk_check_events+0xca/0x4d0 block/disk-events.c:193 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 Function: worker_thread+0xb97/0x11d0 kernel/workqueue.c:3400 Function: kthread+0x3d4/0x800 kernel/kthread.c:463 ============OTHER_INFO============ Function: set_geometry+0xe1d/0x1980 drivers/block/floppy.c:2237 Function: fd_ioctl+0xff4/0x1da0 drivers/block/floppy.c:3912 Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705 Function: vfs_ioctl fs/ioctl.c:51 [inline] Function: __do_sys_ioctl fs/ioctl.c:598 [inline] Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584 =================END============== 3) floppy_work_fn: schedule_bh (write) vs floppy_interrupt->schedule_bh (write) ============ DATARACE ============ Function: schedule_bh drivers/block/floppy.c:1005 [inline] Function: do_wakeup+0x19c/0x220 drivers/block/floppy.c:3219 Function: success_and_wakeup+0x192/0x1e0 drivers/block/floppy.c:1994 Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046 Function: floppy_ready+0x2630/0x4000 Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 ============OTHER_INFO============ Function: floppy_interrupt+0xbf4/0x1220 Function: floppy_hardint+0x432/0x630 Function: __handle_irq_event_percpu+0x10a/0x5d0 kernel/irq/handle.c:158 Function: handle_irq_event+0x8b/0x1e0 kernel/irq/handle.c:210 Function: handle_edge_irq+0x223/0x9f0 kernel/irq/chip.c:855 =================END============== Signed-off-by: Cen Zhang <zzzccc427@gmail.com> Link: https://patch.msgid.link/20260318034810.3089217-1-zzzccc427@gmail.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05floppy: unregister platform device on add_disk failureGuangshuo Li
The change referenced by the Fixes tag reverted a previous fix because that fix added incorrect cleanup for the platform_device_register() failure path. However, reverting the whole change also removed the cleanup for a later failure path. If platform_device_register() succeeds but device_add_disk() fails, the current floppy platform device has already been registered and registered[drive] has been set. The common out_remove_drives path uses while (drive--), so it starts from the previous drive and does not unregister the current one. As a result, the platform device registered for the failing drive is leaked. Unregister the current platform device directly on the device_add_disk() failure path, where platform_device_register() is known to have succeeded. Leave the platform_device_register() failure path unchanged. Fixes: 895a9b37917d ("Revert "floppy: fix reference leak on platform_device_register() failure"") Fixes: 47d34aa2d211 ("floppy: add error handling support for add_disk()") Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Link: https://patch.msgid.link/20260708105703.747262-1-lgs201920130244@gmail.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05floppy: avoid NULL deref in reset_interrupt when cont is clearedYang Xiuwei
reset_fdc() arms do_floppy = reset_interrupt; the IRQ handler then queues that function via schedule_bh(). If unlock_fdc() or do_wakeup() clears cont before the work runs, reset_interrupt() dereferences a NULL cont and oopses. Example crash excerpt: [ 1070.468148] status=80 [ 1070.468152] fdc_busy=1 [ 1070.468158] cont= (null) [ 1070.468161] current_req= (null) [ 1070.468162] command_status=-1 [ 1070.468163] [ 1070.557051] floppy0: floppy timeout called [ 1070.557053] no cont in shutdown! [ 1070.557056] floppy0: floppy_shutdown: timeout handler died. [ 1074.419509] floppy0: FDC access conflict! [ 1074.419782] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 1074.421969] PGD 0 P4D 0 [ 1074.422320] Oops: 0000 [#1] SMP NOPTI [ 1074.422648] CPU: 10 PID: 3269 Comm: kworker/u256:4 Kdump: loaded [ 1074.423830] Hardware name: inspur Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 [ 1074.424284] Workqueue: floppy floppy_work_workfn [floppy] [ 1074.424757] RIP: 0010:reset_interrupt+0x3a/0xa0 [floppy] The same NULL deref has also been reported by syzbot on upstream. Return early if cont is already NULL after result(). The hardware reset has completed; result() still drains the FDC. A later request can lock the FDC and reset again. This is a defensive fix for stale work, not a rewrite of the floppy continuation state machine. Reported-by: syzbot+619e27617b2abe6b9b72@syzkaller.appspotmail.com Link: https://lore.kernel.org/linux-block/00000000000093c4d105f9aa34d6@google.com/ Link: https://lists.openwall.net/linux-kernel/2021/10/27/56 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn> Link: https://patch.msgid.link/20260723073512.11120-1-yangxiuwei@kylinos.cn Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05PCI/P2PDMA: Add Intel Haswell client host bridge to allowlistScott Lee
P2P DMA between two devices that do not share an upstream bridge is only permitted when the traffic goes through a host bridge that is listed in pci_p2pdma_whitelist[] with REQ_SAME_HOST_BRIDGE. The Haswell client host bridge (8086:0c08, e.g. H97/H87/B85) is not in that list, and cpu_supports_p2pdma() returns false on Intel, so calc_map_type_and_dist() refuses P2P for any pair of devices behind different root ports of the same host bridge, even though that root complex handles the traffic correctly. Measured on an ASUS H97-PRO with a Xeon E3-1231 v3 (Haswell, 8086:0c08 at 00:00.0) and two GPUs on separate root ports of that host bridge (00:01.0 and 00:1c.4): - pci_p2pdma_distance() < 0 before the change; peer access granted after (amdgpu stops reporting "PCIe P2P access ... is not supported by the chipset" and hipDeviceCanAccessPeer() returns true in both directions) - 10 KB cross-device copy: 62-75 us vs 130-131 us host-staged (~2x) - 512 MB cross-device copy verified byte-wise against a known buffer: no corruption - tensor-parallel LLM inference (>25 GB model across both GPUs): +53% tokens/s REQ_SAME_HOST_BRIDGE is the correct flag here: the two devices share the upstream bridge (two root ports of one host bridge) rather than sitting behind a PCIe switch. This entry only permits P2P DMA to be used on this platform, it does not force it: the existing checks on ACS redirect, on the map type and on pci_p2pdma_distance() all still apply. Tested on one board only, so the usual caveat applies - broad testing on other Haswell boards would be needed before this can be considered generally safe. Signed-off-by: Scott Lee <dsix123@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20261005132651.18368-1-dsix123@gmail.com
2026-10-05Merge tag 'nvme-7.3-2026-10-05' of git://git.infradead.org/nvme into block-7.3Jens Axboe
Pull NVMe fixes from Keith: "- Fix lock ordering revalidating zoned multipath heads - Fix swapped ZRASF zone state values for full and read only - Fix target p2pmem cleanup when the metadata allocation fails - Fix target status code for invalid NSIDs on reservation features - Revert the NVME_CTRL_NEW state change, which broke the Apple driver" * tag 'nvme-7.3-2026-10-05' of git://git.infradead.org/nvme: Revert "nvme: do not reset controllers in NVME_CTRL_NEW state" nvmet: use the local P2P device on metadata allocation failure nvme-multipath: revalidate head zones after unfreezing the head queue nvme: fix swapped ZRASF zone state values for full and read only nvmet: return Invalid Field for invalid NSIDs feature 82h
2026-10-05dmaengine: bestcomm: Enable compile testingRosen Penev
Allow the BestComm DMA engine to be selected for PowerPC compile-test builds. The freescale ethernet and sound drivers now need a dependency on PPC_MPC52xx as they use headers/functions from that platform. Assisted-by: LLM Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260918175950.21657-1-rosenp@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05spi: rtk-nor: Fix incorrect boolean return valueYu-Chun Lin
The rtk_spi_supports_op() function is expected to return a boolean value. Fix this by returning false instead. Fixes: aca8cbecdd2e ("spi: spi-mem: Add Realtek SPI NOR flash controller driver") Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/lkml/20261002111238.zmU8TY9cdPo1jRPt_Xg1el9kj_ozynuVbJQ2-farWEs@z/ Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com> Link: https://patch.msgid.link/20261005030504.2651773-1-eleanor.lin@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-05dmaengine: xgene-dma: use named initializers for acpi_device_idPawel Zalewski
Use a designated initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant. Unify the list terminator to have a single space between the brackets and no trailing comma. Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260916-acpi-dma-v3-4-0dac05654967@thegoodpenguin.co.uk Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: qcom: use named initializers for acpi_device_idPawel Zalewski
Use a named initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Unify the list terminator to have a single space between the brackets and no trailing comma. Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260916-acpi-dma-v3-3-0dac05654967@thegoodpenguin.co.uk Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: loongson: use named initializers for acpi_device_idPawel Zalewski
Use a named initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Unify the list terminator to have a single space between the brackets and no trailing comma. Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260916-acpi-dma-v3-2-0dac05654967@thegoodpenguin.co.uk Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: dw: use designated initializers for acpi_device_idPawel Zalewski
Use a named initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260916-acpi-dma-v3-1-0dac05654967@thegoodpenguin.co.uk Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05drm/msm/a5xx: Add hangcheck progress detectionDmitry Baryshkov
A5xx has no progress callback, so any submit still running when the hangcheck timer expires is declared hung, and long compute dispatches such as KHR-GLES31.core.compute_shader.simple-compute-shared_context are reset on A530 while still making progress. Comparing the CP IB1/IB2 state, as a3xx and a6xx do, is not enough: during a long dispatch the CP has fetched the whole IB and waits in one packet. Also count ALU working cycles on SP performance counter 0, which Mesa leaves to the kernel (and the kernel hasn't been using up to now). Assisted-by: LLM Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/757302/ Message-ID: <20260930-adreno-progress-v2-3-3882f0fcd7b4@oss.qualcomm.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
2026-10-05drm/msm/a3xx: Add hangcheck progress detectionDmitry Baryshkov
A3xx has no progress callback, so the hangcheck declares a lockup as soon as a submit is still running when the timer expires, no matter whether the CP is advancing. On A306 a piglit tex-miplevel-selection run is a single submit of about 58k draws that takes 1.2-1.3 s to complete, and it gets reset partway through on every run. With the hangcheck period raised to 10 s the same runs pass without a hang. Compare the CP IB1/IB2 base and remaining size between timer expirations, like a6xx does. On A306 these move on every 20 ms sample while such a submit executes and read zero when idle. The prefetch queues are small (32 and 64 for IB1 and IB2), so buffered data does not hide progress for long. Assisted-by: LLM Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/757301/ Message-ID: <20260930-adreno-progress-v2-2-3882f0fcd7b4@oss.qualcomm.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
2026-10-05drm/msm/a2xx: Add hangcheck progress detectionDmitry Baryshkov
A2xx has no progress callback, so any submit still running when the hangcheck timer expires is declared hung, no matter whether the CP is advancing. A false lockup is particularly expensive here: a2xx recovery is unreliable, and a second reset shortly after the first one leaves a2xx_hw_init() failing for good, so everything submitted afterwards fails as well. Compare the CP IB1/IB2 base and remaining size between timer expirations, like a6xx does. Assisted-by: LLM Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/757299/ Message-ID: <20260930-adreno-progress-v2-1-3882f0fcd7b4@oss.qualcomm.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
2026-10-05dmaengine: fsl-edma: Support dynamic scatter/gather chainingBenoît Monin
Implement dynamic linking of scatter/gather transfers to enable chaining multiple DMA descriptors without stopping the channel. This avoids waiting for the channel to go idle if there is another transaction already issued. Add fsl_edma_link_sg() to dynamically link the last TCD of a previously issued descriptor to the first TCD of a new descriptor by setting the scatter/gather address and the E_SG flag, and keeping the channel active by clearing the DREQ bit. Also in fsl_edma_link_sg(), assign a non-zero identifier to the new descriptor that is stored in the EDMA_TCD_CSR_LINKCH field of the CSR of each TCD, after checking that the descriptors are not using channel linking. The use of this field (MAJORLINKCH in the datasheet) as an identifier for dynamic scatter/gather is suggested in the i.MX93 datasheet. When the last issued descriptor is the one currently active on the channel and has a single TCD, the scatter/gather address and CSR are also written directly to the hardware registers to ensure the link takes effect immediately, unless the DMA controller requires the DONE bit to be cleared for the CSR change to take effect. Clearing the DONE bit would disrupt the interrupt handler. Linking is done in fsl_edma_issue_pending(), which iterates over the submitted descriptors, links each one to the previously issued descriptor via fsl_edma_link_sg(), and then moves it to the issued list. This ensures that transactions are linked in the order they were issued. Linking of a descriptor is limited to 31 outstanding descriptors on the issued list so the identifier fits in the LINKCH field of the CSR register. The value of zero is left to identify non-linked descriptors. Update fsl_edma_xfer_desc() to avoid re-initializing the hardware when a transfer is already in progress, allowing seamless chaining of descriptors. Modify the transfer completion handler to check the DONE flag in the channel CSR before marking the transfer complete. Since this flag is only available on SoC with the split registers layout, only link transactions for DMA controllers flagged with newly added FSL_EDMA_DRV_CSR_LINKCH. This flag is set for eDMA3 and EDMA4 controllers which are able to perform dynamic scatter/gather linking. The completion handler also reaps issued descriptors whose link channel ID (EDMA_TCD_CSR_LINKCH) has already been passed by the hardware, marking them as completed even if their corresponding interrupt has been missed. Add trace event for scatter/gather linking operations. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Benoît Monin <benoit.monin@bootlin.com> Link: https://patch.msgid.link/20260916-fsl-edma-dyn-sg-v11-2-02792de71b92@bootlin.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: fsl-edma: Implement device_prep_peripheral_dma_vecBenoît Monin
Add implementation of .device_prep_peripheral_dma_vec() callback to setup a scatter/gather DMA transfer from an array of dma_vec structures. Setup a cyclic transfer if the DMA_PREP_REPEAT flag is set. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Benoît Monin <benoit.monin@bootlin.com> Link: https://patch.msgid.link/20260916-fsl-edma-dyn-sg-v11-1-02792de71b92@bootlin.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05spi: dw: Unconditionally stop DMA on errorsChanghuang Liang
dw_spi_dma_stop() and dw_spi_enh_mem_dma_stop() only terminate a DMA channel when the corresponding busy flag is set. They are only called on error paths, where the flags are not guaranteed to match the state of the DMA engine, so a channel may be left running. Terminate the channels and clear the busy flags unconditionally in dw_spi_dma_stop(). A channel may be missing when only one DMA channel is available, so check for that. With that the enhanced memory operation variant is no longer needed, use dw_spi_dma_stop() there as well. Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com> Link: https://patch.msgid.link/20261003161807.59429-1-changhuang.liang@starfivetech.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-05dmaengine: dw-edma: Account for the MSI vector offsetKoichiro Den
get_cached_msi_msg() returns the base message shared by a multi-MSI descriptor. dw-edma currently derives per-channel data from its local IRQ index and does not adjust a common IRQ at all. Both assume eDMA starts at the descriptor's first vector. That is not true when eDMA receives a tail subset. Compose each message from the IRQ offset relative to the descriptor base in both paths. While at it, avoid reading PCI MSI attributes from descriptors owned by non-PCI devices. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260912174023.1227397-4-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: dw-edma: Configure remote interrupt routingKoichiro Den
An endpoint function can reserve an endpoint-local channel while the RC programs it through an exposed register window. Such a channel must route interrupts remotely and ignore them on the endpoint. Use dma_slave_config to set per-channel interrupt routing on idle channels of a local eDMA or HDMA instance. Releasing a remote-routed channel quiesces the hardware and drains its local IRQ before restoring default routing. The eDMA quiesce may stop a complete direction. The caller must own every channel in that direction and stop remote programming first. Suggested-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260912174023.1227397-3-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: Allow drivers to assign static channel IDsKoichiro Den
The dmaengine core assigns channel IDs in registration order. If a driver skips a hardware channel, chan_id can differ from the hardware numbering and a client cannot reliably correlate a requested channel with hardware resources. Let a driver request an exact channel ID before device registration. Reserve static IDs through the existing IDA so they remain unique, while retaining automatic IDA allocation as the default. For example, idma32 uses chan_id to select DMA_CTL_CH() and DMA_XBAR_SEL(), so it relies on ascending registration order to match chan_id with the hardware channel number. Use direction-flattened IDs for dw-edma channels. Unlike the direction-local hardware channel number, these IDs are unique within the DMA device. Suggested-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://lore.kernel.org/r/lm7tadnxsyrypu4mypptlkx5qkytex4qxsijdr5ydud2n3anvf@yakjfjg5ng4u/ Link: https://lore.kernel.org/r/20260813063757.3131865-2-den@valinux.co.jp/ Link: https://lore.kernel.org/r/an4TXwT37vWYEzCn@SMW015318/ Link: https://patch.msgid.link/20260912174023.1227397-2-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05spi: use dmaengine_submit() instead of ->tx_submit()Frank Li
Replace direct dma_async_tx_descriptor->tx_submit() calls with the proper dmaengine_submit() API wrapper. Assisted-by: LLM Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261002192616.161440-1-Frank.Li@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-05dmaengine: ppc4xx: change to %zu format specifiers for size_t argumentsRosen Penev
Several dev_err, dev_dbg, pr_debug, and printk calls use %d or %u format specifiers for size_t arguments (len, pool_size). Fix them to use %zu to avoid warnings on 64-bit builds. Assisted-by: LLM Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260911220308.176962-1-rosenp@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05floppy: flush pending work before releasing resources on init failureKarl Mehltretter
do_floppy_init() probes each FDC with user_reset_fdc(), which queues a redo_fd_request() work item on floppy_wq that may still be pending when the probe finishes. When no controller is found, the error path calls floppy_release_irq_and_dma() to free the IRQ and DMA channel, and only later destroys the workqueue. destroy_workqueue() drains the queued work last, so it can run after the IRQ and DMA are already gone: floppy0: no floppy controllers found work still pending The flush used to be here. Commit 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") renamed the label out_flush_work to out_release_dma and dropped it. Restore it so the work drains before the IRQ and DMA are released, as floppy_module_exit() already does. Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Link: https://patch.msgid.link/20260722034435.13432-1-kmehltretter@gmail.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05dmaengine: loongson2-apb-cmc: fix descriptor leak in prep_slave_sg()Diego Fernando Mancera Gomez
loongson2_cmc_dma_prep_slave_sg() allocates the descriptor with kzalloc_flex() before iterating over the scatterlist. If loongson2_cmc_dma_set_xfer_param() fails inside the loop, the function returns ERR_PTR(ret) without freeing the descriptor. At this point the descriptor has not been handed to vchan_tx_prep() yet, so nothing else will ever free it, leaking it on every failed ->device_prep_slave_sg() call (e.g. an unsupported transfer direction or bus width). The neighbouring error path for the num_items check already frees the descriptor before returning; do the same on the set_xfer_param() failure path. Fixes: 1c0028e725f1 ("dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controller") Link: https://lore.kernel.org/all/20260818094957.7D2221F000E9@smtp.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Diego Fernando Mancera Gomez <diegomancera.dev@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bUV3WshMSfTq61n1cgh1i Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260905062833.272484-1-diegomancera.dev@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: amlogic: Add general DMA driver for A9Xianwei Zhao
Amlogic A9 SoCs include a general-purpose DMA controller that can be used by multiple peripherals, such as I2C PIO and I3C. Each peripheral group is associated with a dedicated DMA channel in hardware. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Link: https://patch.msgid.link/20260903-amlogic-dma-v12-2-f769bc344056@amlogic.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05wifi: nxpwifi: bound debug info outputHeyang Tan
nxpwifi_debug_read() provides a PAGE_SIZE buffer to nxpwifi_debug_info_to_buffer(), which formats debug state with unbounded sprintf() calls. The same helper is also used for the firmware dump. Pass the output size to the helper and use scnprintf() while formatting. Clamp the debug table counts and window size to the backing array lengths before accessing them. Assisted-by: LLM Signed-off-by: Heyang Tan <thy15333007817@163.com> Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com> Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
2026-10-05wifi: nxpwifi: bound histogram debugfs outputHeyang Tan
nxpwifi_histogram_read() writes histogram entries to a PAGE_SIZE buffer. Each entry is formatted with sprintf(), so enough populated buckets can write past the allocation. Use scnprintf() with the remaining buffer space when formatting the histogram. Assisted-by: LLM Signed-off-by: Heyang Tan <thy15333007817@163.com> Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com> Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
2026-10-05wifi: nxpwifi: validate variable IE lengths in beacon parserAamir Ahmed
nxpwifi_update_bss_desc_with_ie() stores pointers to the HT, VHT and HE capability and operation elements, to the operating mode notification and to the 20/40 BSS coexistence element, taken from a beacon or probe response, without checking that each element is long enough for the structure the driver later dereferences it as. bss_desc->beacon_buf is a tight kmemdup() of the on-air elements, so a truncated element leaves the stored pointer short of the structure and the consumers read past the end of that allocation at association time. Some of those bytes are copied into the association request, so a rogue access point in range can both trigger the read and receive the result. Reject the frame with -EINVAL when any of these elements is shorter than the structure read from it, as the FH, DS and CF parameter set cases in the same parser already do. The extended capabilities element has no structure size to check against, so nxpwifi_is_ap_11ax_twt_supported()'s read of bcn_ext_cap->data[9] is bounded at that consumer instead. Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x") Assisted-by: LLM Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk> Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com> Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
2026-10-05wifi: nxpwifi: fix missing error codes in _nxpwifi_fw_dpc()Jeff Chen
When nxpwifi_register_cfg80211(), nxpwifi_init_channel_scan_gap(), or nxpwifi_add_virtual_intf() fail, the function jumped to an error label but left ret == 0, causing _nxpwifi_fw_dpc() to return success despite the failure. Fix by propagating the return value of nxpwifi_register_cfg80211() and nxpwifi_init_channel_scan_gap() directly into ret, and by extracting the encoded error from the ERR_PTR wdev with PTR_ERR() before each goto err_add_intf. The P2P client interface path had the same IS_ERR/goto pattern and is fixed in the same way. Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x") Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/linux-wireless/anwshVbQWXXHTJpa@stanley.mountain/ Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
2026-10-05dmaengine: plx_dma: fix NULL pointer deref in plx_dma_isr()Logan Gunthorpe
plx_dma_create() registered the interrupt handler with request_irq() before initializing plxdev->bar. If the device raised an interrupt in that window, plx_dma_isr() would dereference the still-NULL bar. Move the bar assignment ahead of request_irq() so everything the handler can touch is initialized before it can run. Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr> Reported-by: Kyungwook Boo <bookyungwook@gmail.com> Link: https://lore.kernel.org/all/20260610112121.676561-1-jjy600901@snu.ac.kr Fixes: c2dbcaa8c672 ("dmaengine: plx-dma: Implement hardware initialization and cleanup") Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://lore.kernel.org/all/20260610112121.676561-1-jjy600901@snu.ac.kr/T/#u Link: https://patch.msgid.link/20260902062153.31048-11-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: ioat: use sysfs_emit() in per-channel sysfs show()Logan Gunthorpe
Convert the sprintf() calls in the per-channel sysfs attribute show() functions to sysfs_emit(). Acked-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-10-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: ioat: disable relaxed ordering before registering the deviceLogan Gunthorpe
ioat3_dma_probe() disabled PCIe relaxed ordering after calling dma_async_device_register(), so if an error occurs and the code jumps to err_disable_interrupts, the function returns with the device still registered in the core's dma_device_list while the caller frees the ioatdma_device struct, leaving a dangling registration that anything walking the device list can dereference after it's been freed. Move the capability read/write ahead of dma_async_device_register() instead. Nothing after registration depends on relaxed ordering already being disabled, and nothing before it depends on the device being registered, so this is a plain reordering. It also means every remaining step after registration can't fail, so there's no need to ever have to unregister the device once registered. Fixes: 511deae0261c ("dmaengine: ioatdma: disable relaxed ordering for ioatdma") Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260707165906.249F41F000E9@smtp.kernel.org Acked-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://lore.kernel.org/dmaengine/20260707165906.249F41F000E9@smtp.kernel.org/T/#u Link: https://patch.msgid.link/20260902062153.31048-9-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: fix use-after-free of swdma_dev in remove()Logan Gunthorpe
dma_async_device_unregister() can drop the last reference on dma_dev and free swdma_dev synchronously via switchtec_dma_release(), but switchtec_dma_remove() then uses swdma_dev->bar for iounmap(). Cache bar in a local variable before the unregister call. Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260717223431.625EE1F000E9@smtp.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-8-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: disable channels before freeing on registration ↵Logan Gunthorpe
failure When switchtec_dma_create() fails after channels have been added to dma_dev->channels (either from switchtec_dma_chans_enumerate()'s own error path, or from dma_async_device_register() failing), the channel status IRQ is still live while the channels are released and freed, so it can fire mid-teardown against channels that are only partially torn down. Add switchtec_dma_chans_disable(), which frees the channel status IRQ before releasing and freeing channels in both error paths. Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260717223431.625EE1F000E9@smtp.kernel.org Link: https://lore.kernel.org/dmaengine/20260721162822.05CDD1F000E9@smtp.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-7-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: fix chan_status_irq cleanup on create() errorLogan Gunthorpe
chan_status_irq stores an MSI-X vector index, but err_exit freed it with plain free_irq() instead of pci_free_irq(), which would free the wrong Linux IRQ. The guard also treated a valid vector index of 0 as unset, skipping the free entirely in that case and leaving the handler registered against soon-to-be-freed swdma_dev. Initialize chan_status_irq to -1 and use the value being non-negative to signal when to free it with pci_free_irq(). Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260717223431.625EE1F000E9@smtp.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-6-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: make switchtec_dma_chans_release() voidLogan Gunthorpe
switchtec_dma_chans_release() always returned 0, and no caller checked it. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-5-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: fix channel leak on registration failureLogan Gunthorpe
switchtec_dma_chans_release() is called in three places but the underlying memory is not freed in all of those places. In order to clean this up, introduce a switchtec_dma_chans_free() helper that will free the memory. Ensure each call to switchtec_dma_chans_release() has a corresponding switchtec_dma_chans_free() call. (The release in switchtec_dma_remove() pairs with the free in switchtec_dma_release()). swdma_dev->chan_cnt is now set to the number of channels that succeeded when one fails to initialise, so switchtec_dma_chans_free() can still be used if not all channels succeed in being allocated. switchtec_dma_chans_free() also removes each channel from dma_dev->channels before freeing it, since the channel status ISR walks that list and would otherwise dereference freed memory. Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup") Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260717223024.9BB8A1F000E9@smtp.kernel.org Link: https://lore.kernel.org/dmaengine/20260727190604.397DB1F000E9@smtp.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-4-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: fix resource leak in alloc_chan_resourcesLogan Gunthorpe
switchtec_dma_alloc_chan_resources() returns directly on any later failure, without ever freeing the descriptor rings and coherent DMA memory it just allocated. The dmaengine core does not call device_free_chan_resources() when device_alloc_chan_resources() fails, so the driver has to unwind its own partial state. The device-removed check also runs after ring_active and comp_ring_active have already been set true, so a failure there left the channel marked active despite alloc_chan_resources() reporting failure. Add an error-unwind path that disables the channel and frees the descriptor rings on every failure after allocation. ring_active and comp_ring_active are cleared under the same locks switchtec_dma_free_chan_resources() already uses, since the completion tasklet checks comp_ring_active under complete_lock before touching the completion ring, and a stale IRQ can still be in flight when this unwind path runs. Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/dmaengine/20260707165555.350951F000E9@smtp.kernel.org Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup") Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://lore.kernel.org/dmaengine/20260707165555.350951F000E9@smtp.kernel.org/T/#u Link: https://patch.msgid.link/20260902062153.31048-3-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: switchtec-dma: fix double-free in switchtec_dma_free_desc()Logan Gunthorpe
switchtec_dma_free_desc() frees swdma_chan->hw_sq, hw_cq, and every desc_ring[] entry without clearing the pointers afterward. If switchtec_dma_alloc_chan_resources() fails partway through and calls it during unwind, then a later retry of alloc_chan_resources() fails in switchtec_dma_alloc_desc() before reallocating one of those pointers, its own failure path calls switchtec_dma_free_desc() again and frees the same, already-freed pointers a second time. NULL out each pointer as it's freed so a subsequent call is a no-op for anything already released. Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup") Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Link: https://patch.msgid.link/20260902062153.31048-2-logang@deltatee.com Signed-off-by: Vinod Koul <vkoul@kernel.org>