summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaeMyung Kang <charsyam@gmail.com>2026-05-30 23:35:11 +0900
committerNamjae Jeon <linkinjeon@kernel.org>2026-06-06 00:20:36 +0900
commit45dd046ced0f5982a6d64ca449de3a61f5f15669 (patch)
tree2372843927e26eec665e245fe513e6569066f751
parent40d88020d0797f96a93edd2e8edc413c2e2d8f84 (diff)
downloadlinux-stable-45dd046ced0f5982a6d64ca449de3a61f5f15669.tar.gz
linux-stable-45dd046ced0f5982a6d64ca449de3a61f5f15669.zip
ntfs: reinit search context before volume information lookup
On mount the volume inode is searched for $VOLUME_NAME and then, reusing the same search context, for $VOLUME_INFORMATION. The $VOLUME_NAME lookup is optional and its result is otherwise ignored. Once lookup-time validation can reject a corrupt $VOLUME_NAME with -EIO, the search context is left in an undefined state: ntfs_attr_find() documents that on an actual error @ctx->attr is undefined. Continuing the $VOLUME_INFORMATION search from that context is not contractually valid. Reinitialize the search context before the $VOLUME_INFORMATION lookup so it always starts from a well-defined state regardless of the $VOLUME_NAME lookup outcome. Cc: stable@vger.kernel.org # v7.1 Signed-off-by: DaeMyung Kang <charsyam@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-rw-r--r--fs/ntfs/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 081a29583868..ca882e946a22 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1461,6 +1461,7 @@ iput_volume_failed:
vol->volume_label = NULL;
}
+ ntfs_attr_reinit_search_ctx(ctx);
if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0,
ctx) || ctx->attr->non_resident || ctx->attr->flags) {
ntfs_attr_put_search_ctx(ctx);