mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] ntfs: fix incorrect error codes returned to callers
@ 2026-09-02  7:32 Baolin Liu
  2026-09-02  7:32 ` [PATCH 1/5] ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length Baolin Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Baolin Liu @ 2026-09-02  7:32 UTC (permalink / raw)
  To: linkinjeon, hyc.lee; +Cc: ntfs, linux-kernel, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Five places in fs/ntfs/ return the wrong error code: a real errno is
replaced by -1 or by a hardcoded substitute, so callers and userspace see
something unrelated to what actually went wrong. The fixes are
independent of each other.

Patch 1 is different from the rest: there the error is not just
mislabelled, it is not seen as an error at all. -1 is what a normal
comparison returns for "collates before", so ntfs_ie_lookup() acts on it
as a tree-descent hint, and a malformed entry in $Reparse/$R or $ObjId/$O
is silently treated as a lookup miss instead of being reported.

Patches 2 and 3 fix -1 returns in inode.c that reach userspace as EPERM.
Patch 3 loses ENOSPC among others, so a full volume misreports create(),
mkdir() and link().

Patches 4 and 5 restore errors that are already available as an ERR_PTR.
Both collapse -ENOMEM into something else, so an allocation failure is
misreported.

No control flow is changed; every callee already returned these codes.

Based on ntfs-next (0fecc393f206).

Baolin Liu (5):
  ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length
  ntfs: return -ENOMEM from ntfs_inode_attach_all_extents()
  ntfs: preserve the truncate error in ntfs_enlarge_attribute()
  ntfs: propagate the map_mft_record() error in
    ntfs_attrlist_entry_add()
  ntfs: propagate the ntfs_attr_iget() error in update_reparse_data()

 fs/ntfs/attrlist.c | 4 ++--
 fs/ntfs/collate.c  | 2 +-
 fs/ntfs/inode.c    | 7 ++++---
 fs/ntfs/reparse.c  | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-03  7:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-02  7:32 [PATCH 0/5] ntfs: fix incorrect error codes returned to callers Baolin Liu
2026-09-02  7:32 ` [PATCH 1/5] ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length Baolin Liu
2026-09-02  7:32 ` [PATCH 2/5] ntfs: return -ENOMEM from ntfs_inode_attach_all_extents() Baolin Liu
2026-09-03  5:25   ` Hyunchul Lee
2026-09-03  6:43     ` liubaolin
2026-09-03  7:20       ` Hyunchul Lee
2026-09-02  7:32 ` [PATCH 3/5] ntfs: preserve the truncate error in ntfs_enlarge_attribute() Baolin Liu
2026-09-02  7:32 ` [PATCH 4/5] ntfs: propagate the map_mft_record() error in ntfs_attrlist_entry_add() Baolin Liu
2026-09-02  7:32 ` [PATCH 5/5] ntfs: propagate the ntfs_attr_iget() error in update_reparse_data() Baolin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®