mcoverlayfs 4.18: re-define ovl_readlink
Apparently /proc needs it; it's normally implemented using get_link if readlink isn't implemented but proc's get_link crashes the kernel in this case (because nameidata is only defined for open* paths) Change-Id: I1864d6c948db879d33ea29b1b281bf84ff8eeec6
This commit is contained in:
@@ -250,6 +250,22 @@ int ovl_permission(struct inode *inode, int mask)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
|
||||||
|
{
|
||||||
|
struct path realpath;
|
||||||
|
struct inode *realinode;
|
||||||
|
|
||||||
|
ovl_path_real(dentry, &realpath);
|
||||||
|
realinode = realpath.dentry->d_inode;
|
||||||
|
|
||||||
|
if (!realinode->i_op->readlink)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
touch_atime(&realpath);
|
||||||
|
|
||||||
|
return realinode->i_op->readlink(realpath.dentry, buf, bufsiz);
|
||||||
|
}
|
||||||
|
|
||||||
static const char *ovl_get_link(struct dentry *dentry,
|
static const char *ovl_get_link(struct dentry *dentry,
|
||||||
struct inode *inode,
|
struct inode *inode,
|
||||||
struct delayed_call *done)
|
struct delayed_call *done)
|
||||||
@@ -454,6 +470,7 @@ static const struct inode_operations ovl_file_inode_operations = {
|
|||||||
static const struct inode_operations ovl_symlink_inode_operations = {
|
static const struct inode_operations ovl_symlink_inode_operations = {
|
||||||
.setattr = ovl_setattr,
|
.setattr = ovl_setattr,
|
||||||
.get_link = ovl_get_link,
|
.get_link = ovl_get_link,
|
||||||
|
.readlink = ovl_readlink,
|
||||||
.getattr = ovl_getattr,
|
.getattr = ovl_getattr,
|
||||||
.listxattr = ovl_listxattr,
|
.listxattr = ovl_listxattr,
|
||||||
.update_time = ovl_update_time,
|
.update_time = ovl_update_time,
|
||||||
|
|||||||
Reference in New Issue
Block a user