diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2022-02-18 13:47:51 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2022-02-18 13:47:51 +0300 |
commit | a679a61520d8a7b0211a1da990404daf5cc80b72 (patch) | |
tree | b6d8b941ed48b25b693b1a0dc74c2fe7dcaa1d72 | |
parent | 754e0b0e35608ed5206d6a67a791563c631cec07 (diff) | |
download | linux-a679a61520d8a7b0211a1da990404daf5cc80b72.tar.xz |
fuse: fix fileattr op failure
The fileattr API conversion broke lsattr on ntfs3g.
Previously the ioctl(... FS_IOC_GETFLAGS) returned an EINVAL error, but
after the conversion the error returned by the fuse filesystem was not
propagated back to the ioctl() system call, resulting in success being
returned with bogus values.
Fix by checking for outarg.result in fuse_priv_ioctl(), just as generic
ioctl code does.
Reported-by: Jean-Pierre André <jean-pierre.andre@wanadoo.fr>
Fixes: 72227eac177d ("fuse: convert to fileattr")
Cc: <stable@vger.kernel.org> # v5.13
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/fuse/ioctl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c index fbc09dab1f85..df58966bc874 100644 --- a/fs/fuse/ioctl.c +++ b/fs/fuse/ioctl.c @@ -394,9 +394,12 @@ static int fuse_priv_ioctl(struct inode *inode, struct fuse_file *ff, args.out_args[1].value = ptr; err = fuse_simple_request(fm, &args); - if (!err && outarg.flags & FUSE_IOCTL_RETRY) - err = -EIO; - + if (!err) { + if (outarg.result < 0) + err = outarg.result; + else if (outarg.flags & FUSE_IOCTL_RETRY) + err = -EIO; + } return err; } |