Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] remove the inode_post_link and inode_post_rename LSM hooks

This patch removes the inode_post_link and inode_post_rename LSM hooks as
they are unused (and likely useless).

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Stephen Smalley and committed by
Linus Torvalds
e31e14ec a74574aa

+2 -87
+2 -8
fs/namei.c
··· 2012 2012 DQUOT_INIT(dir); 2013 2013 error = dir->i_op->link(old_dentry, dir, new_dentry); 2014 2014 up(&old_dentry->d_inode->i_sem); 2015 - if (!error) { 2015 + if (!error) 2016 2016 fsnotify_create(dir, new_dentry->d_name.name); 2017 - security_inode_post_link(old_dentry, dir, new_dentry); 2018 - } 2019 2017 return error; 2020 2018 } 2021 2019 ··· 2132 2134 d_rehash(new_dentry); 2133 2135 dput(new_dentry); 2134 2136 } 2135 - if (!error) { 2137 + if (!error) 2136 2138 d_move(old_dentry,new_dentry); 2137 - security_inode_post_rename(old_dir, old_dentry, 2138 - new_dir, new_dentry); 2139 - } 2140 2139 return error; 2141 2140 } 2142 2141 ··· 2159 2164 /* The following d_move() should become unconditional */ 2160 2165 if (!(old_dir->i_sb->s_type->fs_flags & FS_ODD_RENAME)) 2161 2166 d_move(old_dentry, new_dentry); 2162 - security_inode_post_rename(old_dir, old_dentry, new_dir, new_dentry); 2163 2167 } 2164 2168 if (target) 2165 2169 up(&target->i_sem);
-49
include/linux/security.h
··· 281 281 * @dir contains the inode structure of the parent directory of the new link. 282 282 * @new_dentry contains the dentry structure for the new link. 283 283 * Return 0 if permission is granted. 284 - * @inode_post_link: 285 - * Set security attributes for a new hard link to a file. 286 - * @old_dentry contains the dentry structure for the existing link. 287 - * @dir contains the inode structure of the parent directory of the new file. 288 - * @new_dentry contains the dentry structure for the new file link. 289 284 * @inode_unlink: 290 285 * Check the permission to remove a hard link to a file. 291 286 * @dir contains the inode structure of parent directory of the file. ··· 321 326 * @new_dir contains the inode structure for parent of the new link. 322 327 * @new_dentry contains the dentry structure of the new link. 323 328 * Return 0 if permission is granted. 324 - * @inode_post_rename: 325 - * Set security attributes on a renamed file or directory. 326 - * @old_dir contains the inode structure for parent of the old link. 327 - * @old_dentry contains the dentry structure of the old link. 328 - * @new_dir contains the inode structure for parent of the new link. 329 - * @new_dentry contains the dentry structure of the new link. 330 329 * @inode_readlink: 331 330 * Check the permission to read the symbolic link. 332 331 * @dentry contains the dentry structure for the file link. ··· 1069 1080 struct dentry *dentry, int mode); 1070 1081 int (*inode_link) (struct dentry *old_dentry, 1071 1082 struct inode *dir, struct dentry *new_dentry); 1072 - void (*inode_post_link) (struct dentry *old_dentry, 1073 - struct inode *dir, struct dentry *new_dentry); 1074 1083 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1075 1084 int (*inode_symlink) (struct inode *dir, 1076 1085 struct dentry *dentry, const char *old_name); ··· 1078 1091 int mode, dev_t dev); 1079 1092 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1080 1093 struct inode *new_dir, struct dentry *new_dentry); 1081 - void (*inode_post_rename) (struct inode *old_dir, 1082 - struct dentry *old_dentry, 1083 - struct inode *new_dir, 1084 - struct dentry *new_dentry); 1085 1094 int (*inode_readlink) (struct dentry *dentry); 1086 1095 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1087 1096 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); ··· 1442 1459 return security_ops->inode_link (old_dentry, dir, new_dentry); 1443 1460 } 1444 1461 1445 - static inline void security_inode_post_link (struct dentry *old_dentry, 1446 - struct inode *dir, 1447 - struct dentry *new_dentry) 1448 - { 1449 - if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode))) 1450 - return; 1451 - security_ops->inode_post_link (old_dentry, dir, new_dentry); 1452 - } 1453 - 1454 1462 static inline int security_inode_unlink (struct inode *dir, 1455 1463 struct dentry *dentry) 1456 1464 { ··· 1495 1521 return 0; 1496 1522 return security_ops->inode_rename (old_dir, old_dentry, 1497 1523 new_dir, new_dentry); 1498 - } 1499 - 1500 - static inline void security_inode_post_rename (struct inode *old_dir, 1501 - struct dentry *old_dentry, 1502 - struct inode *new_dir, 1503 - struct dentry *new_dentry) 1504 - { 1505 - if (unlikely (IS_PRIVATE (old_dentry->d_inode) || 1506 - (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode)))) 1507 - return; 1508 - security_ops->inode_post_rename (old_dir, old_dentry, 1509 - new_dir, new_dentry); 1510 1524 } 1511 1525 1512 1526 static inline int security_inode_readlink (struct dentry *dentry) ··· 2119 2157 return 0; 2120 2158 } 2121 2159 2122 - static inline void security_inode_post_link (struct dentry *old_dentry, 2123 - struct inode *dir, 2124 - struct dentry *new_dentry) 2125 - { } 2126 - 2127 2160 static inline int security_inode_unlink (struct inode *dir, 2128 2161 struct dentry *dentry) 2129 2162 { ··· 2159 2202 { 2160 2203 return 0; 2161 2204 } 2162 - 2163 - static inline void security_inode_post_rename (struct inode *old_dir, 2164 - struct dentry *old_dentry, 2165 - struct inode *new_dir, 2166 - struct dentry *new_dentry) 2167 - { } 2168 2205 2169 2206 static inline int security_inode_readlink (struct dentry *dentry) 2170 2207 {
-17
security/dummy.c
··· 276 276 return 0; 277 277 } 278 278 279 - static void dummy_inode_post_link (struct dentry *old_dentry, 280 - struct inode *inode, 281 - struct dentry *new_dentry) 282 - { 283 - return; 284 - } 285 - 286 279 static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry) 287 280 { 288 281 return 0; ··· 310 317 struct dentry *new_dentry) 311 318 { 312 319 return 0; 313 - } 314 - 315 - static void dummy_inode_post_rename (struct inode *old_inode, 316 - struct dentry *old_dentry, 317 - struct inode *new_inode, 318 - struct dentry *new_dentry) 319 - { 320 - return; 321 320 } 322 321 323 322 static int dummy_inode_readlink (struct dentry *dentry) ··· 856 871 set_to_dummy_if_null(ops, inode_init_security); 857 872 set_to_dummy_if_null(ops, inode_create); 858 873 set_to_dummy_if_null(ops, inode_link); 859 - set_to_dummy_if_null(ops, inode_post_link); 860 874 set_to_dummy_if_null(ops, inode_unlink); 861 875 set_to_dummy_if_null(ops, inode_symlink); 862 876 set_to_dummy_if_null(ops, inode_mkdir); 863 877 set_to_dummy_if_null(ops, inode_rmdir); 864 878 set_to_dummy_if_null(ops, inode_mknod); 865 879 set_to_dummy_if_null(ops, inode_rename); 866 - set_to_dummy_if_null(ops, inode_post_rename); 867 880 set_to_dummy_if_null(ops, inode_readlink); 868 881 set_to_dummy_if_null(ops, inode_follow_link); 869 882 set_to_dummy_if_null(ops, inode_permission);
-13
security/selinux/hooks.c
··· 2009 2009 return may_link(dir, old_dentry, MAY_LINK); 2010 2010 } 2011 2011 2012 - static void selinux_inode_post_link(struct dentry *old_dentry, struct inode *inode, struct dentry *new_dentry) 2013 - { 2014 - return; 2015 - } 2016 - 2017 2012 static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry) 2018 2013 { 2019 2014 int rc; ··· 2049 2054 struct inode *new_inode, struct dentry *new_dentry) 2050 2055 { 2051 2056 return may_rename(old_inode, old_dentry, new_inode, new_dentry); 2052 - } 2053 - 2054 - static void selinux_inode_post_rename(struct inode *old_inode, struct dentry *old_dentry, 2055 - struct inode *new_inode, struct dentry *new_dentry) 2056 - { 2057 - return; 2058 2057 } 2059 2058 2060 2059 static int selinux_inode_readlink(struct dentry *dentry) ··· 4246 4257 .inode_init_security = selinux_inode_init_security, 4247 4258 .inode_create = selinux_inode_create, 4248 4259 .inode_link = selinux_inode_link, 4249 - .inode_post_link = selinux_inode_post_link, 4250 4260 .inode_unlink = selinux_inode_unlink, 4251 4261 .inode_symlink = selinux_inode_symlink, 4252 4262 .inode_mkdir = selinux_inode_mkdir, 4253 4263 .inode_rmdir = selinux_inode_rmdir, 4254 4264 .inode_mknod = selinux_inode_mknod, 4255 4265 .inode_rename = selinux_inode_rename, 4256 - .inode_post_rename = selinux_inode_post_rename, 4257 4266 .inode_readlink = selinux_inode_readlink, 4258 4267 .inode_follow_link = selinux_inode_follow_link, 4259 4268 .inode_permission = selinux_inode_permission,