mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
synced 2025-09-29 12:19:07 +10:00
fs/xattr: Fix handling of AT_FDCWD in setxattrat(2) and getxattrat(2)
Currently, setxattrat(2) and getxattrat(2) are wrongly handling the
calls of the from setxattrat(AF_FDCWD, NULL, AT_EMPTY_PATH, ...) and
fail with -EBADF error instead of operating on CWD. Fix it.
Fixes: 6140be90ec
("fs/xattr: add *at family syscalls")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/20250424132246.16822-2-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
1d28f25d6a
commit
f520bed25d
@ -703,7 +703,7 @@ static int path_setxattrat(int dfd, const char __user *pathname,
|
||||
return error;
|
||||
|
||||
filename = getname_maybe_null(pathname, at_flags);
|
||||
if (!filename) {
|
||||
if (!filename && dfd >= 0) {
|
||||
CLASS(fd, f)(dfd);
|
||||
if (fd_empty(f))
|
||||
error = -EBADF;
|
||||
@ -847,7 +847,7 @@ static ssize_t path_getxattrat(int dfd, const char __user *pathname,
|
||||
return error;
|
||||
|
||||
filename = getname_maybe_null(pathname, at_flags);
|
||||
if (!filename) {
|
||||
if (!filename && dfd >= 0) {
|
||||
CLASS(fd, f)(dfd);
|
||||
if (fd_empty(f))
|
||||
return -EBADF;
|
||||
|
Loading…
Reference in New Issue
Block a user