Skip to content

f2fs: Add sanity checks before unlinking and loading inodes

Nikola Z. Ivanov linux-f2fs-devel linux-kernel-mentees lkml 3 versions – Applied

Status from this message: This series was applied to jaegeuk/f2fs.git (dev)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied 2/2
  2. v32 patches 1 replySuperseded
  3. v22 patches 3 repliesSuperseded

Changes in v4 from the cover letter

- Replace F2FS_I_SB(inode) with already obtained f2fs_sb_info pointer.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u

Patches in v4 All 2 applied

#Subject and filesSizeRepliesApplied
1/2f2fs: Rename f2fs_unlink exit labelfs/f2fs/namei.c+7 -71 replyApplied
2/2f2fs: Add sanity checks before unlinking and loading inodesfs/f2fs/inode.c fs/f2fs/namei.c+18 -51 replyApplied

Reviews trailers per patch

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

Patch[email protected]Chao Yu
1/2R-b
2/2T-b R-b

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

Read the v4 thread

Cover letter [PATCH v4 0/2] f2fs: Add sanity checks before unlinking and loading inodes

This series is provoked by syzbot warnings caused by corrupted directory inode with i_nlink == 1 that passes the initial sanity check which will only mark the filesystem as corrupted in case i_nlink == 0.

Tests:
- fio/fsmark parallel create/unlink on VM with f2fs root filesystem.
- syzbot

Changelog:
Changes from v1:
- Rename exit label in f2fs_unlink().
- Add sanity check in sanity_check_inode() and remove it from f2fs_iget() as suggested by Chao Yu in order to detect on-disk corruption early.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#t

Changes from v2:
- Remove i_nlink == 0 check from sanity_check_inode.
- Wrap i_nlink == 1 in unlikely() marco.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u

Changes from v3:
- Replace F2FS_I_SB(inode) with already obtained f2fs_sb_info pointer.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u

Nikola Z. Ivanov (2):
f2fs: Rename f2fs_unlink exit label
f2fs: Add sanity checks before unlinking and loading inodes

 fs/f2fs/inode.c |  6 ++++++
 fs/f2fs/namei.c | 29 ++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)
Signature · 1 line
2.51.0