diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-01-13 03:04:01 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-01-13 03:04:01 +0100 |
commit | f16ab99c2eba233bc97b9f9cc374f7a371fcc363 (patch) | |
tree | d0074bf598a1e2982b72ba3bac8c28fe85ee5cc5 /fs/namei.c | |
parent | Merge tag 'pull-simple_recursive_removal' of git://git.kernel.org/pub/scm/lin... (diff) | |
parent | bch2_ioctl_subvolume_destroy(): fix locking (diff) | |
download | linux-f16ab99c2eba233bc97b9f9cc374f7a371fcc363.tar.xz linux-f16ab99c2eba233bc97b9f9cc374f7a371fcc363.zip |
Merge tag 'pull-bcachefs-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull bcachefs locking fix from Al Viro:
"Fix broken locking in bch2_ioctl_subvolume_destroy()"
* tag 'pull-bcachefs-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
bch2_ioctl_subvolume_destroy(): fix locking
new helper: user_path_locked_at()
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5c318d657503..4e0de939fea1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2572,13 +2572,13 @@ static int filename_parentat(int dfd, struct filename *name, } /* does lookup, returns the object with parent locked */ -static struct dentry *__kern_path_locked(struct filename *name, struct path *path) +static struct dentry *__kern_path_locked(int dfd, struct filename *name, struct path *path) { struct dentry *d; struct qstr last; int type, error; - error = filename_parentat(AT_FDCWD, name, 0, path, &last, &type); + error = filename_parentat(dfd, name, 0, path, &last, &type); if (error) return ERR_PTR(error); if (unlikely(type != LAST_NORM)) { @@ -2597,12 +2597,22 @@ static struct dentry *__kern_path_locked(struct filename *name, struct path *pat struct dentry *kern_path_locked(const char *name, struct path *path) { struct filename *filename = getname_kernel(name); - struct dentry *res = __kern_path_locked(filename, path); + struct dentry *res = __kern_path_locked(AT_FDCWD, filename, path); putname(filename); return res; } +struct dentry *user_path_locked_at(int dfd, const char __user *name, struct path *path) +{ + struct filename *filename = getname(name); + struct dentry *res = __kern_path_locked(dfd, filename, path); + + putname(filename); + return res; +} +EXPORT_SYMBOL(user_path_locked_at); + int kern_path(const char *name, unsigned int flags, struct path *path) { struct filename *filename = getname_kernel(name); |