vfs: default to generic_readlink()
If i_op->readlink is NULL, but i_op->get_link is set then vfs_readlink() defaults to calling generic_readlink(). The IOP_DEFAULT_READLINK flag indicates that the above conditions are met and the default action can be taken. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
このコミットが含まれているのは:
15
fs/namei.c
15
fs/namei.c
@@ -4682,10 +4682,19 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
||||
if (!inode->i_op->readlink)
|
||||
return -EINVAL;
|
||||
if (unlikely(!(inode->i_opflags & IOP_DEFAULT_READLINK))) {
|
||||
if (unlikely(inode->i_op->readlink))
|
||||
return inode->i_op->readlink(dentry, buffer, buflen);
|
||||
|
||||
return inode->i_op->readlink(dentry, buffer, buflen);
|
||||
if (!d_is_symlink(dentry))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock(&inode->i_lock);
|
||||
inode->i_opflags |= IOP_DEFAULT_READLINK;
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
|
||||
return generic_readlink(dentry, buffer, buflen);
|
||||
}
|
||||
EXPORT_SYMBOL(vfs_readlink);
|
||||
|
||||
|
新しいイシューから参照
ユーザーをブロックする