diff options
Diffstat (limited to 'kernel')
-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 | } |