Commit Graph

9 Commits

Author SHA1 Message Date
Namjae Jeon
cd8d29c1b3 ntfs: fix uninitialized variables in ntfs_ea_set_wsl_inode()
Smatch reported uninitialized symbol warnings in ntfs_ea_set_wsl_inode()
and __ntfs_create(). In ntfs_ea_set_wsl_inode(), the err variable could be
returned without initialization if no flags are set and rdev is zero.
Additionally, ea_size might remain uninitialized from the caller's
perspective if no EA operations are performed. While these cases might not
be triggered under current logic, we initialize them to zero to satisfy
the static checker.

Reported-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-04-18 11:33:09 +09:00
Hyunchul Lee
e6a95c5a80 ntfs: harden ntfs_listxattr against EA entries
Validate every EA entry only if the buffer length is required to prevent
large memory allocation.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-16 20:27:40 +09:00
Hyunchul Lee
c451d34ae1 ntfs: harden ntfs_ea_lookup against malformed EA entries
Validate p_ea->ea_name_length tightly, and the used entry size
for every EA.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-16 20:27:38 +09:00
Hyunchul Lee
10993e525b ntfs: check $EA query-length in ntfs_ea_get
if ea_info_qlen exceeds all_ea_size, OOB can happen.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-16 20:27:36 +09:00
Hyunchul Lee
a5325419e9 ntfs: validate WSL EA payload sizes
Enforce the exact-size reads for $LXUID, $LXGID, $LXMOD, $LXDEV.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-16 20:27:34 +09:00
Hyunchul Lee
a732586812 ntfs: fix WSL ea restore condition
Use NTFS_VOL_GID(not NTFS_VOL_UID) for restoring the gid, and call
ntfs_ea_get_wsl_inode() only when $EA_INFORMATION exists.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-16 20:27:30 +09:00
Woody Suwalski
ea3566a3fa ntfs: add missing newlines to pr_err() messages
There is an inconsistent use of pr_err() statements in the current code.
Many error messages are missing the \n termination, what results in the
messages being printed with a delay, only after a next printk() line is
printed. It prevents relying on printk() to monitor the driver errors.
This patch is modifying only text messages, no functional change.

Signed-off-by: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-10 17:52:13 +09:00
Ethan Tidmore
40c31f0563 ntfs: Fix null pointer dereference
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.

Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-02-26 18:26:00 +09:00
Namjae Jeon
fc053f05ca ntfs: add reparse and ea operations
Implement support for Extended Attributes and Reparse Points, enabling
Posix ACL support and, and compatibility with Windows Subsystem for
Linux (WSL) metadata.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-02-19 21:50:54 +09:00