Skip to content

[Deepin-Kernel-SIG] [linux 6.6.y] [FROMLIST] mei: vsc: Initialize mutexes before requesting the IRQ - #2117

Merged
opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-09-01-stable-for-deepin-p1-fixes
Sep 2, 2026
Merged

[Deepin-Kernel-SIG] [linux 6.6.y] [FROMLIST] mei: vsc: Initialize mutexes before requesting the IRQ#2117
opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-09-01-stable-for-deepin-p1-fixes

Conversation

@opsiff

@opsiff opsiff commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

Fix MEI VSC probe initialization ordering and make NTFS filesystem registration failure handling safer.

Bug Fixes:

  • Initialize MEI VSC mutexes before requesting the IRQ and clean them up when IRQ registration fails, preventing interrupt handlers from accessing uninitialized synchronization primitives.
  • Register the NTFS filesystem before enabling its legacy registration path, ensuring legacy setup only occurs after filesystem registration succeeds.

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>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @opsiff, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 hours and 27 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The 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 setup

sequenceDiagram
    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
Loading

Sequence diagram for NTFS filesystem registration order

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Initialize VSC transport mutexes before registering the IRQ, and clean them up when IRQ registration fails.
  • Move both mutex initializations ahead of request_threaded_irq().
  • Route IRQ-request failures through the mutex-destruction cleanup path.
  • Retain IRQ release before mutex destruction for later probe failures.
drivers/misc/mei/vsc-tp.c
Register the NTFS filesystem before registering its legacy filesystem alias.
  • Move legacy registration until after register_filesystem() succeeds.
  • Preserve failure cleanup when primary filesystem registration fails.
fs/ntfs3/super.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@opsiff
opsiff merged commit 9cde192 into deepin-community:linux-6.6.y Sep 2, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants