UPSTREAM: ANDROID: fuse-bpf: Report errors to finalize

Ensure finalize has access to the returned error code, if it had one.

Test: generic/377
Bug: 217570523
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Id9a0aca10c3158f8b414e0cbc2dd1282bb5ef16b
This commit is contained in:
Daniel Rosenberg 2022-03-09 17:29:18 -08:00 • committed by Alexander Martinz
commit d932a916a2
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2
2 changed files with 9 additions and 4 deletions

View file

@ -557,12 +557,15 @@ int fuse_listxattr_backing(struct fuse_args *fa, struct dentry *dentry,
vfs_listxattr(get_fuse_dentry(dentry)->backing_path.dentry,
list, size);
if (ret < 0)
return ret;
if (fa->out_argvar)
fa->out_args[0].size = ret;
else
((struct fuse_getxattr_out *)fa->out_args[0].value)->size = ret;
return 0;
return ret;
}
void *fuse_listxattr_finalize(struct fuse_args *fa, struct dentry *dentry,
@ -570,11 +573,13 @@ void *fuse_listxattr_finalize(struct fuse_args *fa, struct dentry *dentry,
{
struct fuse_getxattr_out *fgo;
if (fa->error_in)
return NULL;
if (fa->out_argvar)
return ERR_PTR(fa->out_args[0].size);
fgo = fa->out_args[0].value;
return ERR_PTR(fgo->size);
}

View file

@ -1843,12 +1843,12 @@ struct fuse_err_ret {
ERR_PTR(backing(&fa, args)), \
true, \
}; \
if (IS_ERR(fer.result)) \
fa.error_in = PTR_ERR(fer.result); \
if (!(ext_flags & FUSE_BPF_POST_FILTER)) \
break; \
\
fa.opcode |= FUSE_POSTFILTER; \
if (IS_ERR(fer.result)) \
fa.error_in = PTR_ERR(fer.result); \
for (i = 0; i < fa.out_numargs; ++i) \
fa.in_args[fa.in_numargs++] = \
(struct fuse_in_arg) { \