mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +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),
|
.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;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
err = vfs_getattr(&fuse_entry->backing_path, &stat,
|
err = vfs_getattr(&fuse_entry->backing_path, &stat,
|
||||||
STATX_BASIC_STATS, 0);
|
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 *file1_name = "file1";
|
||||||
const char *file2_name = "file2";
|
const char *file2_name = "file2";
|
||||||
|
const char *file3_name = "file3";
|
||||||
int result = TEST_FAILURE;
|
int result = TEST_FAILURE;
|
||||||
int bpf_fd = -1;
|
int bpf_fd = -1;
|
||||||
int src_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),
|
TEST(fd = s_open(s_path(s(mount_dir), s(file2_name)), O_RDONLY),
|
||||||
fd != -1);
|
fd != -1);
|
||||||
TESTSYSCALL(close(fd));
|
TESTSYSCALL(close(fd));
|
||||||
|
TESTEQUAL(s_open(s_path(s(mount_dir), s(file3_name)), O_RDONLY),
|
||||||
|
-1);
|
||||||
FUSE_DAEMON
|
FUSE_DAEMON
|
||||||
|
struct fuse_in_header *in_header =
|
||||||
|
(struct fuse_in_header *)bytes_in;
|
||||||
struct fuse_entry_out *feo;
|
struct fuse_entry_out *feo;
|
||||||
struct fuse_entry_bpf_out *febo;
|
struct fuse_entry_bpf_out *febo;
|
||||||
|
|
||||||
TESTFUSELOOKUP(file1_name, FUSE_POSTFILTER);
|
TESTFUSELOOKUP(file1_name, FUSE_POSTFILTER);
|
||||||
TESTFUSEOUTERROR(-ENOENT);
|
TESTFUSEOUTERROR(-ENOENT);
|
||||||
|
|
||||||
TESTFUSELOOKUP(file2_name, FUSE_POSTFILTER);
|
TESTFUSELOOKUP(file2_name, FUSE_POSTFILTER);
|
||||||
feo = (struct fuse_entry_out *) (bytes_in +
|
feo = (struct fuse_entry_out *) (bytes_in +
|
||||||
sizeof(struct fuse_in_header) + strlen(file2_name) + 1);
|
sizeof(struct fuse_in_header) + strlen(file2_name) + 1);
|
||||||
febo = (struct fuse_entry_bpf_out *) ((char *)feo +
|
febo = (struct fuse_entry_bpf_out *) ((char *)feo +
|
||||||
sizeof(*feo));
|
sizeof(*feo));
|
||||||
TESTFUSEOUT2(fuse_entry_out, *feo, fuse_entry_bpf_out, *febo);
|
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
|
FUSE_DONE
|
||||||
|
|
||||||
result = TEST_SUCCESS;
|
result = TEST_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user