aboutsummaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-03-17 18:26:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-15 15:06:56 -0400
commitc6f493d631c4d40cea5c36055f9148f547b200af (patch)
tree233b04dca85cd796dffe1284a55b1fba24d0d59a /security/security.c
parentc5ef60352893b139147b7c033354e8e028e7f52a (diff)
VFS: security/: d_backing_inode() annotations
most of the ->d_inode uses there refer to the same inode IO would go to, i.e. d_backing_inode() Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/security/security.c b/security/security.c
index 730ac65a5737..8e9b1f4b9b45 100644
--- a/security/security.c
+++ b/security/security.c
@@ -410,7 +410,7 @@ EXPORT_SYMBOL(security_old_inode_init_security);
410int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, 410int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
411 unsigned int dev) 411 unsigned int dev)
412{ 412{
413 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 413 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
414 return 0; 414 return 0;
415 return security_ops->path_mknod(dir, dentry, mode, dev); 415 return security_ops->path_mknod(dir, dentry, mode, dev);
416} 416}
@@ -418,7 +418,7 @@ EXPORT_SYMBOL(security_path_mknod);
418 418
419int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) 419int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)
420{ 420{
421 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 421 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
422 return 0; 422 return 0;
423 return security_ops->path_mkdir(dir, dentry, mode); 423 return security_ops->path_mkdir(dir, dentry, mode);
424} 424}
@@ -426,14 +426,14 @@ EXPORT_SYMBOL(security_path_mkdir);
426 426
427int security_path_rmdir(struct path *dir, struct dentry *dentry) 427int security_path_rmdir(struct path *dir, struct dentry *dentry)
428{ 428{
429 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 429 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
430 return 0; 430 return 0;
431 return security_ops->path_rmdir(dir, dentry); 431 return security_ops->path_rmdir(dir, dentry);
432} 432}
433 433
434int security_path_unlink(struct path *dir, struct dentry *dentry) 434int security_path_unlink(struct path *dir, struct dentry *dentry)
435{ 435{
436 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 436 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
437 return 0; 437 return 0;
438 return security_ops->path_unlink(dir, dentry); 438 return security_ops->path_unlink(dir, dentry);
439} 439}
@@ -442,7 +442,7 @@ EXPORT_SYMBOL(security_path_unlink);
442int security_path_symlink(struct path *dir, struct dentry *dentry, 442int security_path_symlink(struct path *dir, struct dentry *dentry,
443 const char *old_name) 443 const char *old_name)
444{ 444{
445 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 445 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
446 return 0; 446 return 0;
447 return security_ops->path_symlink(dir, dentry, old_name); 447 return security_ops->path_symlink(dir, dentry, old_name);
448} 448}
@@ -450,7 +450,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
450int security_path_link(struct dentry *old_dentry, struct path *new_dir, 450int security_path_link(struct dentry *old_dentry, struct path *new_dir,
451 struct dentry *new_dentry) 451 struct dentry *new_dentry)
452{ 452{
453 if (unlikely(IS_PRIVATE(old_dentry->d_inode))) 453 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
454 return 0; 454 return 0;
455 return security_ops->path_link(old_dentry, new_dir, new_dentry); 455 return security_ops->path_link(old_dentry, new_dir, new_dentry);
456} 456}
@@ -459,8 +459,8 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
459 struct path *new_dir, struct dentry *new_dentry, 459 struct path *new_dir, struct dentry *new_dentry,
460 unsigned int flags) 460 unsigned int flags)
461{ 461{
462 if (unlikely(IS_PRIVATE(old_dentry->d_inode) || 462 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) ||
463 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) 463 (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry)))))
464 return 0; 464 return 0;
465 465
466 if (flags & RENAME_EXCHANGE) { 466 if (flags & RENAME_EXCHANGE) {
@@ -477,21 +477,21 @@ EXPORT_SYMBOL(security_path_rename);
477 477
478int security_path_truncate(struct path *path) 478int security_path_truncate(struct path *path)
479{ 479{
480 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 480 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
481 return 0; 481 return 0;
482 return security_ops->path_truncate(path); 482 return security_ops->path_truncate(path);
483} 483}
484 484
485int security_path_chmod(struct path *path, umode_t mode) 485int security_path_chmod(struct path *path, umode_t mode)
486{ 486{
487 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 487 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
488 return 0; 488 return 0;
489 return security_ops->path_chmod(path, mode); 489 return security_ops->path_chmod(path, mode);
490} 490}
491 491
492int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) 492int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
493{ 493{
494 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 494 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
495 return 0; 495 return 0;
496 return security_ops->path_chown(path, uid, gid); 496 return security_ops->path_chown(path, uid, gid);
497} 497}
@@ -513,14 +513,14 @@ EXPORT_SYMBOL_GPL(security_inode_create);
513int security_inode_link(struct dentry *old_dentry, struct inode *dir, 513int security_inode_link(struct dentry *old_dentry, struct inode *dir,
514 struct dentry *new_dentry) 514 struct dentry *new_dentry)
515{ 515{
516 if (unlikely(IS_PRIVATE(old_dentry->d_inode))) 516 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
517 return 0; 517 return 0;
518 return security_ops->inode_link(old_dentry, dir, new_dentry); 518 return security_ops->inode_link(old_dentry, dir, new_dentry);
519} 519}
520 520
521int security_inode_unlink(struct inode *dir, struct dentry *dentry) 521int security_inode_unlink(struct inode *dir, struct dentry *dentry)
522{ 522{
523 if (unlikely(IS_PRIVATE(dentry->d_inode))) 523 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
524 return 0; 524 return 0;
525 return security_ops->inode_unlink(dir, dentry); 525 return security_ops->inode_unlink(dir, dentry);
526} 526}
@@ -543,7 +543,7 @@ EXPORT_SYMBOL_GPL(security_inode_mkdir);
543 543
544int security_inode_rmdir(struct inode *dir, struct dentry *dentry) 544int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
545{ 545{
546 if (unlikely(IS_PRIVATE(dentry->d_inode))) 546 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
547 return 0; 547 return 0;
548 return security_ops->inode_rmdir(dir, dentry); 548 return security_ops->inode_rmdir(dir, dentry);
549} 549}
@@ -559,8 +559,8 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
559 struct inode *new_dir, struct dentry *new_dentry, 559 struct inode *new_dir, struct dentry *new_dentry,
560 unsigned int flags) 560 unsigned int flags)
561{ 561{
562 if (unlikely(IS_PRIVATE(old_dentry->d_inode) || 562 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) ||
563 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) 563 (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry)))))
564 return 0; 564 return 0;
565 565
566 if (flags & RENAME_EXCHANGE) { 566 if (flags & RENAME_EXCHANGE) {
@@ -576,14 +576,14 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
576 576
577int security_inode_readlink(struct dentry *dentry) 577int security_inode_readlink(struct dentry *dentry)
578{ 578{
579 if (unlikely(IS_PRIVATE(dentry->d_inode))) 579 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
580 return 0; 580 return 0;
581 return security_ops->inode_readlink(dentry); 581 return security_ops->inode_readlink(dentry);
582} 582}
583 583
584int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) 584int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
585{ 585{
586 if (unlikely(IS_PRIVATE(dentry->d_inode))) 586 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
587 return 0; 587 return 0;
588 return security_ops->inode_follow_link(dentry, nd); 588 return security_ops->inode_follow_link(dentry, nd);
589} 589}
@@ -599,7 +599,7 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
599{ 599{
600 int ret; 600 int ret;
601 601
602 if (unlikely(IS_PRIVATE(dentry->d_inode))) 602 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
603 return 0; 603 return 0;
604 ret = security_ops->inode_setattr(dentry, attr); 604 ret = security_ops->inode_setattr(dentry, attr);
605 if (ret) 605 if (ret)
@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(security_inode_setattr);
610 610
611int security_inode_getattr(const struct path *path) 611int security_inode_getattr(const struct path *path)
612{ 612{
613 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 613 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
614 return 0; 614 return 0;
615 return security_ops->inode_getattr(path); 615 return security_ops->inode_getattr(path);
616} 616}
@@ -620,7 +620,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name,
620{ 620{
621 int ret; 621 int ret;
622 622
623 if (unlikely(IS_PRIVATE(dentry->d_inode))) 623 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
624 return 0; 624 return 0;
625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags); 625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags);
626 if (ret) 626 if (ret)
@@ -634,7 +634,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name,
634void security_inode_post_setxattr(struct dentry *dentry, const char *name, 634void security_inode_post_setxattr(struct dentry *dentry, const char *name,
635 const void *value, size_t size, int flags) 635 const void *value, size_t size, int flags)
636{ 636{
637 if (unlikely(IS_PRIVATE(dentry->d_inode))) 637 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
638 return; 638 return;
639 security_ops->inode_post_setxattr(dentry, name, value, size, flags); 639 security_ops->inode_post_setxattr(dentry, name, value, size, flags);
640 evm_inode_post_setxattr(dentry, name, value, size); 640 evm_inode_post_setxattr(dentry, name, value, size);
@@ -642,14 +642,14 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name,
642 642
643int security_inode_getxattr(struct dentry *dentry, const char *name) 643int security_inode_getxattr(struct dentry *dentry, const char *name)
644{ 644{
645 if (unlikely(IS_PRIVATE(dentry->d_inode))) 645 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
646 return 0; 646 return 0;
647 return security_ops->inode_getxattr(dentry, name); 647 return security_ops->inode_getxattr(dentry, name);
648} 648}
649 649
650int security_inode_listxattr(struct dentry *dentry) 650int security_inode_listxattr(struct dentry *dentry)
651{ 651{
652 if (unlikely(IS_PRIVATE(dentry->d_inode))) 652 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
653 return 0; 653 return 0;
654 return security_ops->inode_listxattr(dentry); 654 return security_ops->inode_listxattr(dentry);
655} 655}
@@ -658,7 +658,7 @@ int security_inode_removexattr(struct dentry *dentry, const char *name)
658{ 658{
659 int ret; 659 int ret;
660 660
661 if (unlikely(IS_PRIVATE(dentry->d_inode))) 661 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
662 return 0; 662 return 0;
663 ret = security_ops->inode_removexattr(dentry, name); 663 ret = security_ops->inode_removexattr(dentry, name);
664 if (ret) 664 if (ret)