Skip to content

ntfs: fix index walk NULL deref and WSL symlink leak

DaeMyung Kang linux-fsdevel lkml 2 versions – Applied

Status from this message: Applied them to #ntfs-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 3 repliesApplied
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- 1/2: switch IS_ERR_OR_NULL() to IS_ERR() in the walk_down loop (Namjae Jeon).

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2ntfs: fix NULL dereference in ntfs_index_walk_down()fs/ntfs/dir.c fs/ntfs/index.c+23 -71 reply
2/2ntfs: fix WSL symlink target leak on reparse failurefs/ntfs/reparse.c+3 -21 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchHyunchul Lee
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] ntfs: fix index walk NULL deref and WSL symlink leak

v2:
- 1/2: switch IS_ERR_OR_NULL() to IS_ERR() in the walk_down loop (Namjae Jeon).

v1: https://lore.kernel.org/all/[email protected]/

Two independent fixes for the new fs/ntfs/ that landed in v7.1-rc1.

1/2 fixes a NULL dereference in ntfs_index_walk_down(). When
kvzalloc() for ictx->ib fails, or ntfs_ib_read() fails mid traversal, the function previously returned a state that ntfs_index_next() and ntfs_readdir() could not distinguish from end-of-directory, and ntfs_ib_read() itself could write through a NULL ictx->ib. Errors are now propagated as ERR_PTR() through ntfs_index_next() up to ntfs_readdir(). Reproduced with failslab fault injection on getdents64; the reproducer is described in the commit log.

2/2 fixes a target-string leak in ntfs_reparse_set_wsl_symlink()
when ntfs_set_ntfs_reparse_data() fails. Also switches the kvfree() on the local failure path to kfree() to match the kmalloc() done by ntfs_ucstonls().

The two patches are independent and may be applied in any order.

DaeMyung Kang (2):
ntfs: fix NULL dereference in ntfs_index_walk_down()
ntfs: fix WSL symlink target leak on reparse failure

 fs/ntfs/dir.c     | 13 ++++++++++---
 fs/ntfs/index.c   | 17 +++++++++++++----
 fs/ntfs/reparse.c |  5 +++--
 3 files changed, 26 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0