Skip to content

Commit acec737

Browse files
committed
Revert "throne_tracker: avoid cross fs access (#2626)"
This reverts commit 0b6998b.
1 parent 0b6998b commit acec737

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

kernel/throne_tracker.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/string.h>
66
#include <linux/types.h>
77
#include <linux/version.h>
8-
#include <linux/namei.h>
98

109
#include "allowlist.h"
1110
#include "klog.h" // IWYU pragma: keep
@@ -116,7 +115,6 @@ struct my_dir_context {
116115
void *private_data;
117116
int depth;
118117
int *stop;
119-
struct super_block* root_sb;
120118
};
121119
// https://docs.kernel.org/filesystems/porting.html
122120
// filldir_t (readdir callbacks) calling conventions have changed. Instead of returning 0 or -E... it returns bool now. false means "no more" (as -E... used to) and true - "keep going" (as 0 in old calling conventions). Rationale: callers never looked at specific -E... values anyway. -> iterate_shared() instances require no changes at all, all filldir_t ones in the tree converted.
@@ -137,8 +135,6 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
137135
struct my_dir_context *my_ctx =
138136
container_of(ctx, struct my_dir_context, ctx);
139137
char dirpath[DATA_PATH_LEN];
140-
int err;
141-
struct path path;
142138

143139
if (!my_ctx) {
144140
pr_err("Invalid context\n");
@@ -165,18 +161,6 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
165161
return FILLDIR_ACTOR_CONTINUE;
166162
}
167163

168-
err = kern_path(dirpath, 0, &path);
169-
170-
if (err) {
171-
pr_err("get dirpath %s err: %d\n", dirpath, err);
172-
return FILLDIR_ACTOR_CONTINUE;
173-
}
174-
175-
if (my_ctx->root_sb != path.dentry->d_inode->i_sb) {
176-
pr_info("skip cross fs: %s", dirpath);
177-
return FILLDIR_ACTOR_CONTINUE;
178-
}
179-
180164
if (d_type == DT_DIR && my_ctx->depth > 0 &&
181165
(my_ctx->stop && !*my_ctx->stop)) {
182166
struct data_path *data = kmalloc(sizeof(struct data_path), GFP_ATOMIC);
@@ -226,19 +210,10 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
226210

227211
void search_manager(const char *path, int depth, struct list_head *uid_data)
228212
{
229-
int i, stop = 0, err;
213+
int i, stop = 0;
230214
struct list_head data_path_list;
231-
struct path kpath;
232-
struct super_block* root_sb;
233215
INIT_LIST_HEAD(&data_path_list);
234216

235-
err = kern_path(path, 0, &kpath);
236-
237-
if (err) {
238-
pr_err("get search root %s err: %d\n", path, err);
239-
return;
240-
}
241-
242217
// Initialize APK cache list
243218
struct apk_path_hash *pos, *n;
244219
list_for_each_entry(pos, &apk_path_hash_list, list) {
@@ -251,8 +226,6 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
251226
data.depth = depth;
252227
list_add_tail(&data.list, &data_path_list);
253228

254-
root_sb = kpath.dentry->d_inode->i_sb;
255-
256229
for (i = depth; i >= 0; i--) {
257230
struct data_path *pos, *n;
258231

@@ -262,8 +235,7 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
262235
.parent_dir = pos->dirpath,
263236
.private_data = uid_data,
264237
.depth = pos->depth,
265-
.stop = &stop,
266-
.root_sb = root_sb };
238+
.stop = &stop };
267239
struct file *file;
268240

269241
if (!stop) {

0 commit comments

Comments
 (0)