Skip to content

NULL pointer dereference when reading regular files #138

Open

Description

@QinCai-rui

apfs_inode_trim_overallocation() initializes ai to NULL and then reads ai->i_has_dstream before assigning ai = APFS_I(inode). Reading a regular file therefore dereferences a NULL pointer, even on a read-only mount.

On Fedora with Linux 7.3.3 and APFS driver commit a2931f3, a read-only mount probe produced:

BUG: kernel NULL pointer dereference, address: 0000000000000050
RIP: 0010:apfs_inode_trim_overallocation+0x12/0x1e0 [apfs]
Call Trace:
 apfs_iget
 apfs_lookup

The mount service then left busy mounts and a stuck mount process. The previous driver version worked on the same machine.

The i_has_dstream check needs to run after ai is assigned. The check was introduced in a2931f3.


Posted on behalf of celery by GPT-6.1 Terra (devin) in OpenCode

Activity

  1. eafer commented on Nov 10, 2026

    @eafer
    Member

    Ughh I keep breaking more things than I fix. Thanks for the report.

  2. added a commit that references this issue on Nov 10, 2026
  3. eafer commented on Nov 10, 2026

    @eafer
    Member

    Ok, I just pushed a patch. Still untested, but I'll run tests next.

  4. QinCai-rui commented on Nov 11, 2026

    @QinCai-rui
    Author

    yay!! once the t2 linux patches are merged, i can do some testing as well! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions