Go to file
Qiu-ji Chen fb0e226394 dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()
[ Upstream commit 157ae5ffd7 ]

Fix a potential deadlock bug. Observe that in the mtk-cqdma.c
file, functions like mtk_cqdma_issue_pending() and
mtk_cqdma_free_active_desc() properly acquire the pc lock before the vc
lock when handling pc and vc fields. However, mtk_cqdma_tx_status()
violates this order by first acquiring the vc lock before invoking
mtk_cqdma_find_active_desc(), which subsequently takes the pc lock. This
reversed locking sequence (vc → pc) contradicts the established
pc → vc order and creates deadlock risks.

Fix the issue by moving the vc lock acquisition code from
mtk_cqdma_find_active_desc() to mtk_cqdma_tx_status(). Ensure the pc lock
is acquired before the vc lock in the calling function to maintain correct
locking hierarchy. Note that since mtk_cqdma_find_active_desc() is a
static function with only one caller (mtk_cqdma_tx_status()), this
modification safely eliminates the deadlock possibility without affecting
other components.

This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs to extract
function pairs that can be concurrently executed, and then analyzes the
instructions in the paired functions to identify possible concurrency bugs
including deadlocks, data races and atomicity violations.

Fixes: b1f01e48df ("dmaengine: mediatek: Add MediaTek Command-Queue DMA controller for MT6765 SoC")
Cc: stable@vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20250508073634.3719-1-chenqiuji666@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:54:19 +02:00
arch x86/mm/64: define ARCH_PAGE_TABLE_SYNC_MASK and arch_sync_kernel_mappings() 2025-09-09 18:54:17 +02:00
block block: reject invalid operation in submit_bio_noacct 2025-08-28 16:26:10 +02:00
certs
crypto
Documentation bonding: Add independent control state machine 2025-08-28 16:26:18 +02:00
drivers dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status() 2025-09-09 18:54:19 +02:00
fs btrfs: adjust subpage bit start based on sectorsize 2025-09-09 18:54:19 +02:00
include PCI/MSI: Add an option to write MSIX ENTRY_DATA before any reads 2025-09-09 18:54:18 +02:00
init
io_uring io_uring/poll: fix POLLERR handling 2025-07-24 08:51:48 +02:00
ipc
kernel cpufreq/sched: Explicitly synchronize limits_changed flag handling 2025-09-09 18:54:18 +02:00
lib maple_tree: fix mt_destroy_walk() on root leaf node 2025-07-17 18:32:09 +02:00
LICENSES
mm mm/slub: avoid accessing metadata when pointer is invalid in object_err() 2025-09-09 18:54:18 +02:00
net batman-adv: fix OOB read/write in network-coding decode 2025-09-09 18:54:18 +02:00
rust
samples samples: mei: Fix building on musl libc 2025-08-15 12:04:55 +02:00
scripts kconfig: lxdialog: fix 'space' to (de)select options 2025-08-28 16:26:02 +02:00
security apparmor: use the condition in AA_BUG_FMT even with debug disabled 2025-08-28 16:26:01 +02:00
sound ALSA: usb-audio: Add mute TLV for playback volumes on some devices 2025-09-09 18:54:16 +02:00
tools selftest: net: Fix weird setsockopt() in bind_bhash.c. 2025-09-09 18:54:16 +02:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 6.1.150 2025-09-04 15:26:31 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.