diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-04 10:06:33 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-01-05 11:54:28 -0500 |
| commit | acfa4380efe77e290d3a96b11cd4c9f24f4fbb18 (patch) | |
| tree | d656232c7ef39c83681c2de4c8e28ba439242f66 | |
| parent | 9742df331deb3fce95b321f38d4ea0c4e75edb63 (diff) | |
inode->i_op is never NULL
We used to have rather schizophrenic set of checks for NULL ->i_op even
though it had been eliminated years ago. You'd need to go out of your
way to set it to NULL explicitly _and_ a bunch of code would die on
such inodes anyway. After killing two remaining places that still
did that bogosity, all that crap can go away.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/cifs/inode.c | 2 | ||||
| -rw-r--r-- | fs/ecryptfs/inode.c | 3 | ||||
| -rw-r--r-- | fs/namei.c | 32 | ||||
| -rw-r--r-- | fs/nfsd/vfs.c | 8 | ||||
| -rw-r--r-- | fs/open.c | 2 | ||||
| -rw-r--r-- | fs/stat.c | 2 | ||||
| -rw-r--r-- | fs/xattr.c | 2 | ||||
| -rw-r--r-- | mm/memory.c | 4 | ||||
| -rw-r--r-- | mm/nommu.c | 2 | ||||
| -rw-r--r-- | security/commoncap.c | 6 |
10 files changed, 28 insertions, 35 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index f247da9f4edc..5ab9896fdcb2 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -1641,7 +1641,7 @@ do_expand: | |||
| 1641 | i_size_write(inode, offset); | 1641 | i_size_write(inode, offset); |
| 1642 | spin_unlock(&inode->i_lock); | 1642 | spin_unlock(&inode->i_lock); |
| 1643 | out_truncate: | 1643 | out_truncate: |
| 1644 | if (inode->i_op && inode->i_op->truncate) | 1644 | if (inode->i_op->truncate) |
| 1645 | inode->i_op->truncate(inode); | 1645 | inode->i_op->truncate(inode); |
| 1646 | return 0; | 1646 | return 0; |
| 1647 | out_sig: | 1647 | out_sig: |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 5e78fc179886..0111906a8877 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -612,8 +612,7 @@ ecryptfs_readlink(struct dentry *dentry, char __user * buf, int bufsiz) | |||
| 612 | struct ecryptfs_crypt_stat *crypt_stat; | 612 | struct ecryptfs_crypt_stat *crypt_stat; |
| 613 | 613 | ||
| 614 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 614 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 615 | if (!lower_dentry->d_inode->i_op || | 615 | if (!lower_dentry->d_inode->i_op->readlink) { |
| 616 | !lower_dentry->d_inode->i_op->readlink) { | ||
| 617 | rc = -EINVAL; | 616 | rc = -EINVAL; |
| 618 | goto out; | 617 | goto out; |
| 619 | } | 618 | } |
diff --git a/fs/namei.c b/fs/namei.c index dd5c9f0bf829..1f6656c3d1b9 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -257,7 +257,7 @@ int inode_permission(struct inode *inode, int mask) | |||
| 257 | return -EACCES; | 257 | return -EACCES; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | if (inode->i_op && inode->i_op->permission) | 260 | if (inode->i_op->permission) |
| 261 | retval = inode->i_op->permission(inode, mask); | 261 | retval = inode->i_op->permission(inode, mask); |
| 262 | else | 262 | else |
| 263 | retval = generic_permission(inode, mask, NULL); | 263 | retval = generic_permission(inode, mask, NULL); |
| @@ -432,7 +432,7 @@ static int exec_permission_lite(struct inode *inode) | |||
| 432 | { | 432 | { |
| 433 | umode_t mode = inode->i_mode; | 433 | umode_t mode = inode->i_mode; |
| 434 | 434 | ||
| 435 | if (inode->i_op && inode->i_op->permission) | 435 | if (inode->i_op->permission) |
| 436 | return -EAGAIN; | 436 | return -EAGAIN; |
| 437 | 437 | ||
| 438 | if (current_fsuid() == inode->i_uid) | 438 | if (current_fsuid() == inode->i_uid) |
| @@ -908,9 +908,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd) | |||
| 908 | inode = next.dentry->d_inode; | 908 | inode = next.dentry->d_inode; |
| 909 | if (!inode) | 909 | if (!inode) |
| 910 | goto out_dput; | 910 | goto out_dput; |
| 911 | err = -ENOTDIR; | ||
| 912 | if (!inode->i_op) | ||
| 913 | goto out_dput; | ||
| 914 | 911 | ||
| 915 | if (inode->i_op->follow_link) { | 912 | if (inode->i_op->follow_link) { |
| 916 | err = do_follow_link(&next, nd); | 913 | err = do_follow_link(&next, nd); |
| @@ -920,9 +917,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd) | |||
| 920 | inode = nd->path.dentry->d_inode; | 917 | inode = nd->path.dentry->d_inode; |
| 921 | if (!inode) | 918 | if (!inode) |
| 922 | break; | 919 | break; |
| 923 | err = -ENOTDIR; | ||
| 924 | if (!inode->i_op) | ||
| 925 | break; | ||
| 926 | } else | 920 | } else |
| 927 | path_to_nameidata(&next, nd); | 921 | path_to_nameidata(&next, nd); |
| 928 | err = -ENOTDIR; | 922 | err = -ENOTDIR; |
| @@ -961,7 +955,7 @@ last_component: | |||
| 961 | break; | 955 | break; |
| 962 | inode = next.dentry->d_inode; | 956 | inode = next.dentry->d_inode; |
| 963 | if ((lookup_flags & LOOKUP_FOLLOW) | 957 | if ((lookup_flags & LOOKUP_FOLLOW) |
| 964 | && inode && inode->i_op && inode->i_op->follow_link) { | 958 | && inode && inode->i_op->follow_link) { |
| 965 | err = do_follow_link(&next, nd); | 959 | err = do_follow_link(&next, nd); |
| 966 | if (err) | 960 | if (err) |
| 967 | goto return_err; | 961 | goto return_err; |
| @@ -973,7 +967,7 @@ last_component: | |||
| 973 | break; | 967 | break; |
| 974 | if (lookup_flags & LOOKUP_DIRECTORY) { | 968 | if (lookup_flags & LOOKUP_DIRECTORY) { |
| 975 | err = -ENOTDIR; | 969 | err = -ENOTDIR; |
| 976 | if (!inode->i_op || !inode->i_op->lookup) | 970 | if (!inode->i_op->lookup) |
| 977 | break; | 971 | break; |
| 978 | } | 972 | } |
| 979 | goto return_base; | 973 | goto return_base; |
| @@ -1469,7 +1463,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
| 1469 | if (error) | 1463 | if (error) |
| 1470 | return error; | 1464 | return error; |
| 1471 | 1465 | ||
| 1472 | if (!dir->i_op || !dir->i_op->create) | 1466 | if (!dir->i_op->create) |
| 1473 | return -EACCES; /* shouldn't it be ENOSYS? */ | 1467 | return -EACCES; /* shouldn't it be ENOSYS? */ |
| 1474 | mode &= S_IALLUGO; | 1468 | mode &= S_IALLUGO; |
| 1475 | mode |= S_IFREG; | 1469 | mode |= S_IFREG; |
| @@ -1752,7 +1746,7 @@ do_last: | |||
| 1752 | error = -ENOENT; | 1746 | error = -ENOENT; |
| 1753 | if (!path.dentry->d_inode) | 1747 | if (!path.dentry->d_inode) |
| 1754 | goto exit_dput; | 1748 | goto exit_dput; |
| 1755 | if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link) | 1749 | if (path.dentry->d_inode->i_op->follow_link) |
| 1756 | goto do_link; | 1750 | goto do_link; |
| 1757 | 1751 | ||
| 1758 | path_to_nameidata(&path, &nd); | 1752 | path_to_nameidata(&path, &nd); |
| @@ -1933,7 +1927,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
| 1933 | if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) | 1927 | if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) |
| 1934 | return -EPERM; | 1928 | return -EPERM; |
| 1935 | 1929 | ||
| 1936 | if (!dir->i_op || !dir->i_op->mknod) | 1930 | if (!dir->i_op->mknod) |
| 1937 | return -EPERM; | 1931 | return -EPERM; |
| 1938 | 1932 | ||
| 1939 | error = devcgroup_inode_mknod(mode, dev); | 1933 | error = devcgroup_inode_mknod(mode, dev); |
| @@ -2035,7 +2029,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
| 2035 | if (error) | 2029 | if (error) |
| 2036 | return error; | 2030 | return error; |
| 2037 | 2031 | ||
| 2038 | if (!dir->i_op || !dir->i_op->mkdir) | 2032 | if (!dir->i_op->mkdir) |
| 2039 | return -EPERM; | 2033 | return -EPERM; |
| 2040 | 2034 | ||
| 2041 | mode &= (S_IRWXUGO|S_ISVTX); | 2035 | mode &= (S_IRWXUGO|S_ISVTX); |
| @@ -2126,7 +2120,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 2126 | if (error) | 2120 | if (error) |
| 2127 | return error; | 2121 | return error; |
| 2128 | 2122 | ||
| 2129 | if (!dir->i_op || !dir->i_op->rmdir) | 2123 | if (!dir->i_op->rmdir) |
| 2130 | return -EPERM; | 2124 | return -EPERM; |
| 2131 | 2125 | ||
| 2132 | DQUOT_INIT(dir); | 2126 | DQUOT_INIT(dir); |
| @@ -2213,7 +2207,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 2213 | if (error) | 2207 | if (error) |
| 2214 | return error; | 2208 | return error; |
| 2215 | 2209 | ||
| 2216 | if (!dir->i_op || !dir->i_op->unlink) | 2210 | if (!dir->i_op->unlink) |
| 2217 | return -EPERM; | 2211 | return -EPERM; |
| 2218 | 2212 | ||
| 2219 | DQUOT_INIT(dir); | 2213 | DQUOT_INIT(dir); |
| @@ -2320,7 +2314,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) | |||
| 2320 | if (error) | 2314 | if (error) |
| 2321 | return error; | 2315 | return error; |
| 2322 | 2316 | ||
| 2323 | if (!dir->i_op || !dir->i_op->symlink) | 2317 | if (!dir->i_op->symlink) |
| 2324 | return -EPERM; | 2318 | return -EPERM; |
| 2325 | 2319 | ||
| 2326 | error = security_inode_symlink(dir, dentry, oldname); | 2320 | error = security_inode_symlink(dir, dentry, oldname); |
| @@ -2401,7 +2395,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
| 2401 | */ | 2395 | */ |
| 2402 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | 2396 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) |
| 2403 | return -EPERM; | 2397 | return -EPERM; |
| 2404 | if (!dir->i_op || !dir->i_op->link) | 2398 | if (!dir->i_op->link) |
| 2405 | return -EPERM; | 2399 | return -EPERM; |
| 2406 | if (S_ISDIR(inode->i_mode)) | 2400 | if (S_ISDIR(inode->i_mode)) |
| 2407 | return -EPERM; | 2401 | return -EPERM; |
| @@ -2608,7 +2602,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 2608 | if (error)< | ||
