[Deepin-Kernel-SIG] [linux 6.6.y] [FROMLIST] mei: vsc: Initialize mutexes before requesting the IRQ - #2117
Conversation
The threaded IRQ handler vsc_tp_thread_isr() unconditionally locks tp->event_notify_mutex, but vsc_tp_probe() initializes both mutexes only after request_threaded_irq() has succeeded. A pending wake interrupt during probe can therefore run mutex_lock() on zeroed, uninitialized mutex state. Move both mutex_init() calls before request_threaded_irq() and destroy the mutexes if IRQ registration fails. Fixes: 18f14b2 ("mei: vsc: Event notifier fixes") Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
init_ntfs_fs() registers the legacy "ntfs" alias before the primary "ntfs3" type, but the error path for a failed primary registration does not unregister the alias. If register_filesystem(&ntfs_fs_type) fails (e.g. because that filesystem name is already present), module initialization returns an error while ntfs_legacy_fs_type remains in the global filesystem list and points into module memory that is about to be unloaded. Register the primary type first; since register_as_ntfs_legacy() tolerates its own failure, no later failing operation can strand the alias. Fixes: 7487179 ("ntfs3: serve as alias for the legacy ntfs driver") Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes initialization ordering in the MEI VSC probe so IRQ callbacks cannot observe uninitialized mutexes, while ensuring failure cleanup remains correct, and adjusts NTFS initialization to register the primary filesystem before its legacy alias. Sequence diagram for MEI VSC probe initialization and IRQ setupsequenceDiagram
participant Probe as vsc_tp_probe
participant Mutex as Mutexes
participant IRQ as Threaded IRQ
participant Cleanup as Error cleanup
Probe->>Mutex: mutex_init(&tp->mutex)
Probe->>Mutex: mutex_init(&tp->event_notify_mutex)
Probe->>IRQ: request_threaded_irq(spi->irq, vsc_tp_isr, vsc_tp_thread_isr)
alt IRQ request succeeds
IRQ-->>Probe: success
else IRQ request fails
IRQ-->>Probe: error
Probe->>Cleanup: mutex_destroy(&tp->event_notify_mutex)
Probe->>Cleanup: mutex_destroy(&tp->mutex)
end
Sequence diagram for NTFS filesystem registration ordersequenceDiagram
participant Init as init_ntfs_fs
participant FS as VFS filesystem registry
participant Alias as NTFS legacy alias
Init->>FS: register_filesystem(&ntfs_fs_type)
alt registration succeeds
FS-->>Init: success
Init->>Alias: register_as_ntfs_legacy()
Alias-->>Init: return
else registration fails
FS-->>Init: error
Init-->>Init: cleanup and return error
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🟢 Approval recommended
Both ordering fixes correctly cover their associated failure paths without introducing unresolved issues.
Pull request overview
Fixes initialization ordering and failure cleanup in MEI VSC and NTFS3.
Changes:
- Initializes VSC mutexes before IRQ registration and cleans them up on failure.
- Registers NTFS legacy support only after NTFS3 registration succeeds.
File summaries
| File | Description |
|---|---|
fs/ntfs3/super.c |
Prevents legacy registration when NTFS3 registration fails. |
drivers/misc/mei/vsc-tp.c |
Ensures IRQ handlers only access initialized mutexes. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary by Sourcery
Fix MEI VSC probe initialization ordering and make NTFS filesystem registration failure handling safer.
Bug Fixes: