From: Ethan Tidmore <ethantidmore06@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>, Hyunchul Lee <hyc.lee@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH] ntfs: Fix null pointer dereference
Date: Wed, 25 Feb 2026 16:24:53 -0600 [thread overview]
Message-ID: <20260225222453.1962678-1-ethantidmore06@gmail.com> (raw)
The variable ctx can be null and once confirmed to be null in its error
path goes to label err_out. Once there it can be immediately dereferenced
by the function ntfs_attr_put_search_ctx() which has no null pointer check.
Detected by Smatch:
fs/ntfs/ea.c:687 ntfs_new_attr_flags() error:
we previously assumed 'ctx' could be null (see line 577)
Add null pointer check before running ntfs_attr_put_search_ctx() in
error path.
Fixes: fc053f05ca282 ("ntfs: add reparse and ea operations")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
fs/ntfs/ea.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c
index 82ad9b61ec64..b2b0a9a043a9 100644
--- a/fs/ntfs/ea.c
+++ b/fs/ntfs/ea.c
@@ -684,7 +684,8 @@ static int ntfs_new_attr_flags(struct ntfs_inode *ni, __le32 fattr)
a->flags = new_aflags;
mark_mft_record_dirty(ctx->ntfs_ino);
err_out:
- ntfs_attr_put_search_ctx(ctx);
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
return err;
}
--
2.53.0
next reply other threads:[~2026-02-25 22:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 22:24 Ethan Tidmore [this message]
2026-02-26 2:32 ` [PATCH] ntfs: Fix null pointer dereference Hyunchul Lee
2026-02-26 9:28 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225222453.1962678-1-ethantidmore06@gmail.com \
--to=ethantidmore06@gmail.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox