mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ANDROID: fuse-bpf: set error_in to ENOENT in negative lookup
Bug: 250617797 Test: fuse-test passes, app installs Signed-off-by: Paul Lawrence <paullawrence@google.com> Change-Id: I44544f8989d0ddf00a98eaddce5751df6598130f
This commit is contained in:
@@ -1176,8 +1176,10 @@ int fuse_lookup_backing(struct fuse_bpf_args *fa, struct inode *dir,
|
||||
.mnt = mntget(dir_fuse_entry->backing_path.mnt),
|
||||
};
|
||||
|
||||
if (d_is_negative(backing_entry))
|
||||
if (d_is_negative(backing_entry)) {
|
||||
fa->error_in = -ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = vfs_getattr(&fuse_entry->backing_path, &stat,
|
||||
STATX_BASIC_STATS, 0);
|
||||
|
||||
@@ -1915,6 +1915,7 @@ static int bpf_test_lookup_postfilter(const char *mount_dir)
|
||||
{
|
||||
const char *file1_name = "file1";
|
||||
const char *file2_name = "file2";
|
||||
const char *file3_name = "file3";
|
||||
int result = TEST_FAILURE;
|
||||
int bpf_fd = -1;
|
||||
int src_fd = -1;
|
||||
@@ -1944,18 +1945,27 @@ static int bpf_test_lookup_postfilter(const char *mount_dir)
|
||||
TEST(fd = s_open(s_path(s(mount_dir), s(file2_name)), O_RDONLY),
|
||||
fd != -1);
|
||||
TESTSYSCALL(close(fd));
|
||||
TESTEQUAL(s_open(s_path(s(mount_dir), s(file3_name)), O_RDONLY),
|
||||
-1);
|
||||
FUSE_DAEMON
|
||||
struct fuse_in_header *in_header =
|
||||
(struct fuse_in_header *)bytes_in;
|
||||
struct fuse_entry_out *feo;
|
||||
struct fuse_entry_bpf_out *febo;
|
||||
|
||||
TESTFUSELOOKUP(file1_name, FUSE_POSTFILTER);
|
||||
TESTFUSEOUTERROR(-ENOENT);
|
||||
|
||||
TESTFUSELOOKUP(file2_name, FUSE_POSTFILTER);
|
||||
feo = (struct fuse_entry_out *) (bytes_in +
|
||||
sizeof(struct fuse_in_header) + strlen(file2_name) + 1);
|
||||
febo = (struct fuse_entry_bpf_out *) ((char *)feo +
|
||||
sizeof(*feo));
|
||||
TESTFUSEOUT2(fuse_entry_out, *feo, fuse_entry_bpf_out, *febo);
|
||||
|
||||
TESTFUSELOOKUP(file3_name, FUSE_POSTFILTER);
|
||||
TESTEQUAL(in_header->error_in, -ENOENT);
|
||||
TESTFUSEOUTERROR(-ENOENT);
|
||||
FUSE_DONE
|
||||
|
||||
result = TEST_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user