UPSTREAM: ANDROID: fuse-bpf: Close backing fds in fuse_dentry_revalidate

Bug: 202785178
Test: fuse_test runs, no leak on Android
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: If3c8dbe680f21c646e98f66140b842869c2c5abf
This commit is contained in:
Paul Lawrence 2021-12-21 00:13:39 +00:00 • committed by Alexander Martinz
commit 950ab97234
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2

View file

@ -237,6 +237,15 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
&entry->d_name, &outarg, &bpf_outarg);
ret = fuse_simple_request(fm, &args);
dput(parent);
/*
* TODO This doesn't seem sufficient, though we don't plan to
* change the backing file ever, so not sure what is correct
* here yet, especially as we can't return an error to user
*/
if (bpf_outarg.backing_action == FUSE_ACTION_REPLACE)
__close_fd(fm->fc->task->files, bpf_outarg.backing_fd);
/* Zero nodeid is same as -ENOENT */
if (!ret && !outarg.nodeid)
ret = -ENOENT;