aboutsummaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c
index a02f243f09c0..c3586c0d97e2 100644
--- a/security/security.c
+++ b/security/security.c
@@ -373,6 +373,72 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
373} 373}
374EXPORT_SYMBOL(security_inode_init_security); 374EXPORT_SYMBOL(security_inode_init_security);
375 375
376#ifdef CONFIG_SECURITY_PATH
377int security_path_mknod(struct path *path, struct dentry *dentry, int mode,
378 unsigned int dev)
379{
380 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
381 return 0;
382 return security_ops->path_mknod(path, dentry, mode, dev);
383}
384EXPORT_SYMBOL(security_path_mknod);
385
386int security_path_mkdir(struct path *path, struct dentry *dentry, int mode)
387{
388 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
389 return 0;
390 return security_ops->path_mkdir(path, dentry, mode);
391}
392
393int security_path_rmdir(struct path *path, struct dentry *dentry)
394{
395 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
396 return 0;
397 return security_ops->path_rmdir(path, dentry);
398}
399
400int security_path_unlink(struct path *path, struct dentry *dentry)
401{
402 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
403 return 0;
404 return security_ops->path_unlink(path, dentry);
405}
406
407int security_path_symlink(struct path *path, struct dentry *dentry,
408 const char *old_name)
409{
410 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
411 return 0;
412 return security_ops->path_symlink(path, dentry, old_name);
413}
414
415int security_path_link(struct dentry *old_dentry, struct path *new_dir,
416 struct dentry *new_dentry)
417{
418 if (unlikely(IS_PRIVATE(old_dentry->d_inode)))
419 return 0;
420 return security_ops->path_link(old_dentry, new_dir, new_dentry);
421}
422
423int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
424 struct path *new_dir, struct dentry *new_dentry)
425{
426 if (unlikely(IS_PRIVATE(old_dentry->d_inode) ||
427 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode))))
428 return 0;
429 return security_ops->path_rename(old_dir, old_dentry, new_dir,
430 new_dentry);
431}
432
433int security_path_truncate(struct path *path, loff_t length,
434 unsigned int time_attrs)
435{
436 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
437 return 0;
438 return security_ops->path_truncate(path, length, time_attrs);
439}
440#endif
441
376int security_inode_create(struct inode *dir, struct dentry *dentry, int mode) 442int security_inode_create(struct inode *dir, struct dentry *dentry, int mode)
377{ 443{
378 if (unlikely(IS_PRIVATE(dir))) 444 if (unlikely(IS_PRIVATE(dir)))