diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-14 19:01:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:35:02 -0400 |
commit | 79714f72d3b964611997de512cb29198c9f2dbbb (patch) | |
tree | 27560778736691d1edb8276897f4ed3b9411bcb2 /kernel/audit_watch.c | |
parent | 1acf0af9b981027f3e73e93f0d3f85abdc794f71 (diff) |
get rid of kern_path_parent()
all callers want the same thing, actually - a kinda-sorta analog of
kern_path_create(). I.e. they want parent vfsmount/dentry (with
->i_mutex held, to make sure the child dentry is still their child)
+ the child dentry.
Signed-off-by Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/audit_watch.c')
-rw-r--r-- | kernel/audit_watch.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index e683869365d9..3823281401b5 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -355,34 +355,15 @@ static void audit_remove_parent_watches(struct audit_parent *parent) | |||
355 | /* Get path information necessary for adding watches. */ | 355 | /* Get path information necessary for adding watches. */ |
356 | static int audit_get_nd(struct audit_watch *watch, struct path *parent) | 356 | static int audit_get_nd(struct audit_watch *watch, struct path *parent) |
357 | { | 357 | { |
358 | struct nameidata nd; | 358 | struct dentry *d = kern_path_locked(watch->path, parent); |
359 | struct dentry *d; | 359 | if (IS_ERR(d)) |
360 | int err; | ||
361 | |||
362 | err = kern_path_parent(watch->path, &nd); | ||
363 | if (err) | ||
364 | return err; | ||
365 | |||
366 | if (nd.last_type != LAST_NORM) { | ||
367 | path_put(&nd.path); | ||
368 | return -EINVAL; | ||
369 | } | ||
370 | |||
371 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | ||
372 | d = lookup_one_len(nd.last.name, nd.path.dentry, nd.last.len); | ||
373 | if (IS_ERR(d)) { | ||
374 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | ||
375 | path_put(&nd.path); | ||
376 | return PTR_ERR(d); | 360 | return PTR_ERR(d); |
377 | } | 361 | mutex_unlock(&parent->dentry->d_inode->i_mutex); |
378 | if (d->d_inode) { | 362 | if (d->d_inode) { |
379 | /* update watch filter fields */ | 363 | /* update watch filter fields */ |
380 | watch->dev = d->d_inode->i_sb->s_dev; | 364 | watch->dev = d->d_inode->i_sb->s_dev; |
381 | watch->ino = d->d_inode->i_ino; | 365 | watch->ino = d->d_inode->i_ino; |
382 | } | 366 | } |
383 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | ||
384 | |||
385 | *parent = nd.path; | ||
386 | dput(d); | 367 | dput(d); |
387 | return 0; | 368 | return 0; |
388 | } | 369 | } |