Skip to content

configfs cleanups and fixes

Al Viro linux-fsdevel 2 versions – Merged

Status from this message: has been merged into torvalds/linux.git:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest18 patches 11 repliesMerged
  2. v1 RFC14 patches 20 repliesSuperseded

Patches in v2 Merged

#Subject and filesSizeRepliesApplied
1/18configfs_lookup(): don't leave ->s_dentry dangling on failurefs/configfs/dir.c+3 -00 replies
2/18configfs: fix lockless traversals of ->s_childrenfs/configfs/dir.c+41 -131 reply
3/18configfs_mkdir(): use take_dentry_name_snapshot()fs/configfs/dir.c+6 -100 replies
4/18configfs_detach_prep(): pass configfs_dirent instead of dentryfs/configfs/dir.c+5 -60 replies
5/18configfs_depend_prep(): pass configfs_dirent instead of dentryfs/configfs/dir.c+4 -80 replies
6/18configfs_do_depend_item(): pass configfs_dirent instead of dentryfs/configfs/dir.c+4 -40 replies
7/18configfs_detach_rollback(): pass configfs_dirent instead of dentryfs/configfs/dir.c+4 -50 replies
8/18populate_group(): move cleanup on failure to the sole callerfs/configfs/dir.c+12 -160 replies
9/18populate_attrs(): move cleanup to the sole callerfs/configfs/dir.c+14 -160 replies
10/18configfs_remove_dir(), detach_attrs(): switch to passing dentryfs/configfs/dir.c+20 -400 replies
11/18switch configfs_detach_{group,item}() to passing dentryfs/configfs/dir.c+15 -280 replies
12/18configfs: dentry refcount needs to be pinned only oncefs/configfs/dir.c+5 -50 replies
13/18configfs: mark pinned dentries persistentfs/configfs/dir.c fs/configfs/symlink.c+4 -120 replies
14/18kill configfs_drop_dentry()fs/configfs/configfs_internal.h fs/configfs/dir.c fs/configfs/inode.c+23 -241 reply
15/18configfs_create(): lift parent timestamp updates into callersfs/configfs/dir.c fs/configfs/inode.c+5 -40 replies
16/18configs_attach_item(): drop unused parent_item argumentfs/configfs/dir.c+3 -41 reply
17/18configfs_attach_group(): drop the unused parent_item argumentfs/configfs/dir.c+5 -91 reply
18/18create_default_group(): pass parent's dentry instead of config_groupfs/configfs/dir.c+5 -41 reply

Reviews trailers per patch

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

PatchJan KaraBreno Leitao
1/18R-b R-b
2/18R-b
3/18R-b R-b
4/18R-b R-b
5/18R-b R-b
6/18R-b
7/18R-b
8/18R-b
9/18R-b
10/18R-b
11/18R-b
12/18R-b
13/18R-b
14/18R-b
15/18R-b
16/18R-b
17/18R-b
18/18R-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 00/18] configfs cleanups and fixes

Updated and rebased to -rc6; changes since v1:
* added a fix for races between lseek() and directory removals; had been there since 2008. If we use list_for_each_entry_safe(), we need to make sure that the next object won't get moved around and/or removed while we are in the loop body; holding the directory locked is enough to make sure that another thread won't add/remove stuff to that directory, but it does *not* prevent cursors being moved around. So when lseek() for those switched to global spinlock for list protection, all places that relies upon the directory lock alone for list traversals needed to be modified...
Fixes (configfs_lookup()-triggered UAF and this one) are in
the beginning of the queue; that's #fixes-configfs and the rest is on top of those.
* fixed braindamage in "kill configfs_drop_dentry()" (used to be #13, now #14).
* added several "correct the argument types" patches - removing never unused arguments for configfs_attach_{group,item}() and converting create_default_group() from parent's config_group to parent's dentry.

This branch (7.1-rc6-based) lives in
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #work.configfs Individual patches in followups. It still needs more testing...

Review and testing would be very welcome.

I've also pushed tentative followups out into #more.configfs, but those definitely will miss the coming merge window. Will post separately...

Al Viro (18):
configfs_lookup(): don't leave ->s_dentry dangling on failure
configfs: fix lockless traversals of ->s_children configfs_mkdir(): use take_dentry_name_snapshot() configfs_detach_prep(): pass configfs_dirent instead of dentry configfs_depend_prep(): pass configfs_dirent instead of dentry configfs_do_depend_item(): pass configfs_dirent instead of dentry configfs_detach_rollback(): pass configfs_dirent instead of dentry populate_group(): move cleanup on failure to the sole caller populate_attrs(): move cleanup to the sole caller configfs_remove_dir(), detach_attrs(): switch to passing dentry switch configfs_detach_{group,item}() to passing dentry
configfs: dentry refcount needs to be pinned only once
configfs: mark pinned dentries persistent
kill configfs_drop_dentry()
configfs_create(): lift parent timestamp updates into callers configs_attach_item(): drop unused parent_item argument configfs_attach_group(): drop the unused parent_item argument create_default_group(): pass parent's dentry instead of config_group

 fs/configfs/configfs_internal.h |   1 -
 fs/configfs/dir.c               | 315 ++++++++++++++++----------------
 fs/configfs/inode.c             |  25 ---
 fs/configfs/symlink.c           |   3 +-
 4 files changed, 157 insertions(+), 187 deletions(-)
Signature · 1 line
2.47.3