Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acfa4380 authored by Al Viro's avatar Al Viro
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9742df33
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1641,7 +1641,7 @@ static int cifs_vmtruncate(struct inode *inode, loff_t offset)
	i_size_write(inode, offset);
	i_size_write(inode, offset);
	spin_unlock(&inode->i_lock);
	spin_unlock(&inode->i_lock);
out_truncate:
out_truncate:
	if (inode->i_op && inode->i_op->truncate)
	if (inode->i_op->truncate)
		inode->i_op->truncate(inode);
		inode->i_op->truncate(inode);
	return 0;
	return 0;
out_sig:
out_sig:
+1 −2
Original line number Original line Diff line number Diff line
@@ -612,8 +612,7 @@ ecryptfs_readlink(struct dentry *dentry, char __user * buf, int bufsiz)
	struct ecryptfs_crypt_stat *crypt_stat;
	struct ecryptfs_crypt_stat *crypt_stat;


	lower_dentry = ecryptfs_dentry_to_lower(dentry);
	lower_dentry = ecryptfs_dentry_to_lower(dentry);
	if (!lower_dentry->d_inode->i_op ||
	if (!lower_dentry->d_inode->i_op->readlink) {
	    !lower_dentry->d_inode->i_op->readlink) {
		rc = -EINVAL;
		rc = -EINVAL;
		goto out;
		goto out;
	}
	}
+13 −19
Original line number Original line Diff line number Diff line
@@ -257,7 +257,7 @@ int inode_permission(struct inode *inode, int mask)
			return -EACCES;
			return -EACCES;
	}
	}


	if (inode->i_op && inode->i_op->permission)
	if (inode->i_op->permission)
		retval = inode->i_op->permission(inode, mask);
		retval = inode->i_op->permission(inode, mask);
	else
	else
		retval = generic_permission(inode, mask, NULL);
		retval = generic_permission(inode, mask, NULL);
@@ -432,7 +432,7 @@ static int exec_permission_lite(struct inode *inode)
{
{
	umode_t	mode = inode->i_mode;
	umode_t	mode = inode->i_mode;


	if (inode->i_op && inode->i_op->permission)
	if (inode->i_op->permission)
		return -EAGAIN;
		return -EAGAIN;


	if (current_fsuid() == inode->i_uid)
	if (current_fsuid() == inode->i_uid)
@@ -908,9 +908,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
		inode = next.dentry->d_inode;
		inode = next.dentry->d_inode;
		if (!inode)
		if (!inode)
			goto out_dput;
			goto out_dput;
		err = -ENOTDIR; 
		if (!inode->i_op)
			goto out_dput;


		if (inode->i_op->follow_link) {
		if (inode->i_op->follow_link) {
			err = do_follow_link(&next, nd);
			err = do_follow_link(&next, nd);
@@ -920,9 +917,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
			inode = nd->path.dentry->d_inode;
			inode = nd->path.dentry->d_inode;
			if (!inode)
			if (!inode)
				break;
				break;
			err = -ENOTDIR; 
			if (!inode->i_op)
				break;
		} else
		} else
			path_to_nameidata(&next, nd);
			path_to_nameidata(&next, nd);
		err = -ENOTDIR; 
		err = -ENOTDIR; 
@@ -961,7 +955,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
			break;
			break;
		inode = next.dentry->d_inode;
		inode = next.dentry->d_inode;
		if ((lookup_flags & LOOKUP_FOLLOW)
		if ((lookup_flags & LOOKUP_FOLLOW)
		    && inode && inode->i_op && inode->i_op->follow_link) {
		    && inode && inode->i_op->follow_link) {
			err = do_follow_link(&next, nd);
			err = do_follow_link(&next, nd);
			if (err)
			if (err)
				goto return_err;
				goto return_err;
@@ -973,7 +967,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
			break;
			break;
		if (lookup_flags & LOOKUP_DIRECTORY) {
		if (lookup_flags & LOOKUP_DIRECTORY) {
			err = -ENOTDIR; 
			err = -ENOTDIR; 
			if (!inode->i_op || !inode->i_op->lookup)
			if (!inode->i_op->lookup)
				break;
				break;
		}
		}
		goto return_base;
		goto return_base;
@@ -1469,7 +1463,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
	if (error)
	if (error)
		return error;
		return error;


	if (!dir->i_op || !dir->i_op->create)
	if (!dir->i_op->create)
		return -EACCES;	/* shouldn't it be ENOSYS? */
		return -EACCES;	/* shouldn't it be ENOSYS? */
	mode &= S_IALLUGO;
	mode &= S_IALLUGO;
	mode |= S_IFREG;
	mode |= S_IFREG;
@@ -1752,7 +1746,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
	error = -ENOENT;
	error = -ENOENT;
	if (!path.dentry->d_inode)
	if (!path.dentry->d_inode)
		goto exit_dput;
		goto exit_dput;
	if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link)
	if (path.dentry->d_inode->i_op->follow_link)
		goto do_link;
		goto do_link;


	path_to_nameidata(&path, &nd);
	path_to_nameidata(&path, &nd);
@@ -1933,7 +1927,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
	if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
	if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
		return -EPERM;
		return -EPERM;


	if (!dir->i_op || !dir->i_op->mknod)
	if (!dir->i_op->mknod)
		return -EPERM;
		return -EPERM;


	error = devcgroup_inode_mknod(mode, dev);
	error = devcgroup_inode_mknod(mode, dev);
@@ -2035,7 +2029,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
	if (error)
	if (error)
		return error;
		return error;


	if (!dir->i_op || !dir->i_op->mkdir)
	if (!dir->i_op->mkdir)
		return -EPERM;
		return -EPERM;


	mode &= (S_IRWXUGO|S_ISVTX);
	mode &= (S_IRWXUGO|S_ISVTX);
@@ -2126,7 +2120,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
	if (error)
	if (error)
		return error;
		return error;


	if (!dir->i_op || !dir->i_op->rmdir)
	if (!dir->i_op->rmdir)
		return -EPERM;
		return -EPERM;


	DQUOT_INIT(dir);
	DQUOT_INIT(dir);
@@ -2213,7 +2207,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
	if (error)
	if (error)
		return error;
		return error;


	if (!dir->i_op || !dir->i_op->unlink)
	if (!dir->i_op->unlink)
		return -EPERM;
		return -EPERM;


	DQUOT_INIT(dir);
	DQUOT_INIT(dir);
@@ -2320,7 +2314,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
	if (error)
	if (error)
		return error;
		return error;


	if (!dir->i_op || !dir->i_op->symlink)
	if (!dir->i_op->symlink)
		return -EPERM;
		return -EPERM;


	error = security_inode_symlink(dir, dentry, oldname);
	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
	 */
	 */
	if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
	if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
		return -EPERM;
		return -EPERM;
	if (!dir->i_op || !dir->i_op->link)
	if (!dir->i_op->link)
		return -EPERM;
		return -EPERM;
	if (S_ISDIR(inode->i_mode))
	if (S_ISDIR(inode->i_mode))
		return -EPERM;
		return -EPERM;
@@ -2608,7 +2602,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
	if (error)
	if (error)
		return error;
		return error;


	if (!old_dir->i_op || !old_dir->i_op->rename)
	if (!old_dir->i_op->rename)
		return -EPERM;
		return -EPERM;


	DQUOT_INIT(old_dir);
	DQUOT_INIT(old_dir);
+4 −4
Original line number Original line Diff line number Diff line
@@ -1211,7 +1211,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
	dirp = dentry->d_inode;
	dirp = dentry->d_inode;


	err = nfserr_notdir;
	err = nfserr_notdir;
	if(!dirp->i_op || !dirp->i_op->lookup)
	if (!dirp->i_op->lookup)
		goto out;
		goto out;
	/*
	/*
	 * Check whether the response file handle has been verified yet.
	 * Check whether the response file handle has been verified yet.
@@ -1347,7 +1347,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
	/* Get all the sanity checks out of the way before
	/* Get all the sanity checks out of the way before
	 * we lock the parent. */
	 * we lock the parent. */
	err = nfserr_notdir;
	err = nfserr_notdir;
	if(!dirp->i_op || !dirp->i_op->lookup)
	if (!dirp->i_op->lookup)
		goto out;
		goto out;
	fh_lock_nested(fhp, I_MUTEX_PARENT);
	fh_lock_nested(fhp, I_MUTEX_PARENT);


@@ -1482,7 +1482,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
	inode = dentry->d_inode;
	inode = dentry->d_inode;


	err = nfserr_inval;
	err = nfserr_inval;
	if (!inode->i_op || !inode->i_op->readlink)
	if (!inode->i_op->readlink)
		goto out;
		goto out;


	touch_atime(fhp->fh_export->ex_path.mnt, dentry);
	touch_atime(fhp->fh_export->ex_path.mnt, dentry);
@@ -2162,7 +2162,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
	size_t size;
	size_t size;
	int error;
	int error;


	if (!IS_POSIXACL(inode) || !inode->i_op ||
	if (!IS_POSIXACL(inode) ||
	    !inode->i_op->setxattr || !inode->i_op->removexattr)
	    !inode->i_op->setxattr || !inode->i_op->removexattr)
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	switch(type) {
	switch(type) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -412,7 +412,7 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
	if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0))
	if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0))
		goto out_fput;
		goto out_fput;


	if (inode->i_op && inode->i_op->fallocate)
	if (inode->i_op->fallocate)
		ret = inode->i_op->fallocate(inode, mode, offset, len);
		ret = inode->i_op->fallocate(inode, mode, offset, len);
	else
	else
		ret = -EOPNOTSUPP;
		ret = -EOPNOTSUPP;
Loading