Re: [PATCH v3 1/4] ntfs: replace raw ctx->al_entry with restartable attr-list locators

Namjae Jeon <[email protected]> Wed, 29 Jul 2026 19:04:05 +0900
Newsgroups dev.linux.lists.ntfs
Message-ID <CAKYAXd8AY6N6+DMPvyqoaDfDnOFmMGmWDMTtvnybxwxRZbQSwQ@mail.gmail.com>
> @@ -1129,6 +1220,7 @@ static int ntfs_external_attr_find(const __le32 type,
>         u32 al_name_len;
>         u32 attr_len, mft_free_len;
>         bool is_first_search = false;
> +       bool attr_list_locked = true;
attr_list_locked is initialized to true, but type == AT_END jumps to
not_found before down_read() is called. That path passes uninitialized
al_entry, al_start, and al_end to ntfs_attrlist_capture_insert() and
then calls up_read() on a lock that was never acquired. This can
corrupt the rwsem state or crash the kernel. Initialize the flag to
false, set it only after acquiring the lock, and avoid capturing a
locator on the early AT_END path.