Commit 98bc993f authored by Al Viro's avatar Al Viro

[PATCH] get rid of nameidata in audit_tree

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 421748ec
...@@ -532,7 +532,7 @@ void audit_trim_trees(void) ...@@ -532,7 +532,7 @@ void audit_trim_trees(void)
list_add(&cursor, &tree_list); list_add(&cursor, &tree_list);
while (cursor.next != &tree_list) { while (cursor.next != &tree_list) {
struct audit_tree *tree; struct audit_tree *tree;
struct nameidata nd; struct path path;
struct vfsmount *root_mnt; struct vfsmount *root_mnt;
struct node *node; struct node *node;
struct list_head list; struct list_head list;
...@@ -544,12 +544,12 @@ void audit_trim_trees(void) ...@@ -544,12 +544,12 @@ void audit_trim_trees(void)
list_add(&cursor, &tree->list); list_add(&cursor, &tree->list);
mutex_unlock(&audit_filter_mutex); mutex_unlock(&audit_filter_mutex);
err = path_lookup(tree->pathname, 0, &nd); err = kern_path(tree->pathname, 0, &path);
if (err) if (err)
goto skip_it; goto skip_it;
root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry); root_mnt = collect_mounts(path.mnt, path.dentry);
path_put(&nd.path); path_put(&path);
if (!root_mnt) if (!root_mnt)
goto skip_it; goto skip_it;
...@@ -580,19 +580,19 @@ void audit_trim_trees(void) ...@@ -580,19 +580,19 @@ void audit_trim_trees(void)
} }
static int is_under(struct vfsmount *mnt, struct dentry *dentry, static int is_under(struct vfsmount *mnt, struct dentry *dentry,
struct nameidata *nd) struct path *path)
{ {
if (mnt != nd->path.mnt) { if (mnt != path->mnt) {
for (;;) { for (;;) {
if (mnt->mnt_parent == mnt) if (mnt->mnt_parent == mnt)
return 0; return 0;
if (mnt->mnt_parent == nd->path.mnt) if (mnt->mnt_parent == path->mnt)
break; break;
mnt = mnt->mnt_parent; mnt = mnt->mnt_parent;
} }
dentry = mnt->mnt_mountpoint; dentry = mnt->mnt_mountpoint;
} }
return is_subdir(dentry, nd->path.dentry); return is_subdir(dentry, path->dentry);
} }
int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op)
...@@ -618,7 +618,7 @@ void audit_put_tree(struct audit_tree *tree) ...@@ -618,7 +618,7 @@ void audit_put_tree(struct audit_tree *tree)
int audit_add_tree_rule(struct audit_krule *rule) int audit_add_tree_rule(struct audit_krule *rule)
{ {
struct audit_tree *seed = rule->tree, *tree; struct audit_tree *seed = rule->tree, *tree;
struct nameidata nd; struct path path;
struct vfsmount *mnt, *p; struct vfsmount *mnt, *p;
struct list_head list; struct list_head list;
int err; int err;
...@@ -637,11 +637,11 @@ int audit_add_tree_rule(struct audit_krule *rule) ...@@ -637,11 +637,11 @@ int audit_add_tree_rule(struct audit_krule *rule)
/* do not set rule->tree yet */ /* do not set rule->tree yet */
mutex_unlock(&audit_filter_mutex); mutex_unlock(&audit_filter_mutex);
err = path_lookup(tree->pathname, 0, &nd); err = kern_path(tree->pathname, 0, &path);
if (err) if (err)
goto Err; goto Err;
mnt = collect_mounts(nd.path.mnt, nd.path.dentry); mnt = collect_mounts(path.mnt, path.dentry);
path_put(&nd.path); path_put(&path);
if (!mnt) { if (!mnt) {
err = -ENOMEM; err = -ENOMEM;
goto Err; goto Err;
...@@ -690,29 +690,29 @@ int audit_tag_tree(char *old, char *new) ...@@ -690,29 +690,29 @@ int audit_tag_tree(char *old, char *new)
{ {
struct list_head cursor, barrier; struct list_head cursor, barrier;
int failed = 0; int failed = 0;
struct nameidata nd; struct path path;
struct vfsmount *tagged; struct vfsmount *tagged;
struct list_head list; struct list_head list;
struct vfsmount *mnt; struct vfsmount *mnt;
struct dentry *dentry; struct dentry *dentry;
int err; int err;
err = path_lookup(new, 0, &nd); err = kern_path(new, 0, &path);
if (err) if (err)
return err; return err;
tagged = collect_mounts(nd.path.mnt, nd.path.dentry); tagged = collect_mounts(path.mnt, path.dentry);
path_put(&nd.path); path_put(&path);
if (!tagged) if (!tagged)
return -ENOMEM; return -ENOMEM;
err = path_lookup(old, 0, &nd); err = kern_path(old, 0, &path);
if (err) { if (err) {
drop_collected_mounts(tagged); drop_collected_mounts(tagged);
return err; return err;
} }
mnt = mntget(nd.path.mnt); mnt = mntget(path.mnt);
dentry = dget(nd.path.dentry); dentry = dget(path.dentry);
path_put(&nd.path); path_put(&path);
if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
follow_up(&mnt, &dentry); follow_up(&mnt, &dentry);
...@@ -733,7 +733,7 @@ int audit_tag_tree(char *old, char *new) ...@@ -733,7 +733,7 @@ int audit_tag_tree(char *old, char *new)
list_add(&cursor, &tree->list); list_add(&cursor, &tree->list);
mutex_unlock(&audit_filter_mutex); mutex_unlock(&audit_filter_mutex);
err = path_lookup(tree->pathname, 0, &nd); err = kern_path(tree->pathname, 0, &path);
if (err) { if (err) {
put_tree(tree); put_tree(tree);
mutex_lock(&audit_filter_mutex); mutex_lock(&audit_filter_mutex);
...@@ -741,15 +741,15 @@ int audit_tag_tree(char *old, char *new) ...@@ -741,15 +741,15 @@ int audit_tag_tree(char *old, char *new)
} }
spin_lock(&vfsmount_lock); spin_lock(&vfsmount_lock);
if (!is_under(mnt, dentry, &nd)) { if (!is_under(mnt, dentry, &path)) {
spin_unlock(&vfsmount_lock); spin_unlock(&vfsmount_lock);
path_put(&nd.path); path_put(&path);
put_tree(tree); put_tree(tree);
mutex_lock(&audit_filter_mutex); mutex_lock(&audit_filter_mutex);
continue; continue;
} }
spin_unlock(&vfsmount_lock); spin_unlock(&vfsmount_lock);
path_put(&nd.path); path_put(&path);
list_for_each_entry(p, &list, mnt_list) { list_for_each_entry(p, &list, mnt_list) {
failed = tag_chunk(p->mnt_root->d_inode, tree); failed = tag_chunk(p->mnt_root->d_inode, tree);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment