Skip to content

Commit 98bc993

Browse files
author
Al Viro
committed
[PATCH] get rid of nameidata in audit_tree
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 421748e commit 98bc993

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

‎kernel/audit_tree.c‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ void audit_trim_trees(void)
532532
list_add(&cursor, &tree_list);
533533
while (cursor.next != &tree_list) {
534534
struct audit_tree *tree;
535-
struct nameidata nd;
535+
struct path path;
536536
struct vfsmount *root_mnt;
537537
struct node *node;
538538
struct list_head list;
@@ -544,12 +544,12 @@ void audit_trim_trees(void)
544544
list_add(&cursor, &tree->list);
545545
mutex_unlock(&audit_filter_mutex);
546546

547-
err = path_lookup(tree->pathname, 0, &nd);
547+
err = kern_path(tree->pathname, 0, &path);
548548
if (err)
549549
goto skip_it;
550550

551-
root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
552-
path_put(&nd.path);
551+
root_mnt = collect_mounts(path.mnt, path.dentry);
552+
path_put(&path);
553553
if (!root_mnt)
554554
goto skip_it;
555555

@@ -580,19 +580,19 @@ void audit_trim_trees(void)
580580
}
581581

582582
static int is_under(struct vfsmount *mnt, struct dentry *dentry,
583-
struct nameidata *nd)
583+
struct path *path)
584584
{
585-
if (mnt != nd->path.mnt) {
585+
if (mnt != path->mnt) {
586586
for (;;) {
587587
if (mnt->mnt_parent == mnt)
588588
return 0;
589-
if (mnt->mnt_parent == nd->path.mnt)
589+
if (mnt->mnt_parent == path->mnt)
590590
break;
591591
mnt = mnt->mnt_parent;
592592
}
593593
dentry = mnt->mnt_mountpoint;
594594
}
595-
return is_subdir(dentry, nd->path.dentry);
595+
return is_subdir(dentry, path->dentry);
596596
}
597597

598598
int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op)
@@ -618,7 +618,7 @@ void audit_put_tree(struct audit_tree *tree)
618618
int audit_add_tree_rule(struct audit_krule *rule)
619619
{
620620
struct audit_tree *seed = rule->tree, *tree;
621-
struct nameidata nd;
621+
struct path path;
622622
struct vfsmount *mnt, *p;
623623
struct list_head list;
624624
int err;
@@ -637,11 +637,11 @@ int audit_add_tree_rule(struct audit_krule *rule)
637637
/* do not set rule->tree yet */
638638
mutex_unlock(&audit_filter_mutex);
639639

640-
err = path_lookup(tree->pathname, 0, &nd);
640+
err = kern_path(tree->pathname, 0, &path);
641641
if (err)
642642
goto Err;
643-
mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
644-
path_put(&nd.path);
643+
mnt = collect_mounts(path.mnt, path.dentry);
644+
path_put(&path);
645645
if (!mnt) {
646646
err = -ENOMEM;
647647
goto Err;
@@ -690,29 +690,29 @@ int audit_tag_tree(char *old, char *new)
690690
{
691691
struct list_head cursor, barrier;
692692
int failed = 0;
693-
struct nameidata nd;
693+
struct path path;
694694
struct vfsmount *tagged;
695695
struct list_head list;
696696
struct vfsmount *mnt;
697697
struct dentry *dentry;
698698
int err;
699699

700-
err = path_lookup(new, 0, &nd);
700+
err = kern_path(new, 0, &path);
701701
if (err)
702702
return err;
703-
tagged = collect_mounts(nd.path.mnt, nd.path.dentry);
704-
path_put(&nd.path);
703+
tagged = collect_mounts(path.mnt, path.dentry);
704+
path_put(&path);
705705
if (!tagged)
706706
return -ENOMEM;
707707

708-
err = path_lookup(old, 0, &nd);
708+
err = kern_path(old, 0, &path);
709709
if (err) {
710710
drop_collected_mounts(tagged);
711711
return err;
712712
}
713-
mnt = mntget(nd.path.mnt);
714-
dentry = dget(nd.path.dentry);
715-
path_put(&nd.path);
713+
mnt = mntget(path.mnt);
714+
dentry = dget(path.dentry);
715+
path_put(&path);
716716

717717
if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
718718
follow_up(&mnt, &dentry);
@@ -733,23 +733,23 @@ int audit_tag_tree(char *old, char *new)
733733
list_add(&cursor, &tree->list);
734734
mutex_unlock(&audit_filter_mutex);
735735

736-
err = path_lookup(tree->pathname, 0, &nd);
736+
err = kern_path(tree->pathname, 0, &path);
737737
if (err) {
738738
put_tree(tree);
739739
mutex_lock(&audit_filter_mutex);
740740
continue;
741741
}
742742

743743
spin_lock(&vfsmount_lock);
744-
if (!is_under(mnt, dentry, &nd)) {
744+
if (!is_under(mnt, dentry, &path)) {
745745
spin_unlock(&vfsmount_lock);
746-
path_put(&nd.path);
746+
path_put(&path);
747747
put_tree(tree);
748748
mutex_lock(&audit_filter_mutex);
749749
continue;
750750
}
751751
spin_unlock(&vfsmount_lock);
752-
path_put(&nd.path);
752+
path_put(&path);
753753

754754
list_for_each_entry(p, &list, mnt_list) {
755755
failed = tag_chunk(p->mnt_root->d_inode, tree);

0 commit comments

Comments
 (0)