don't put symlink bodies in pagecache into highmem
kmap() in page_follow_link_light() needed to go - allowing to hold an arbitrary number of kmaps for long is a great way to deadlocking the system. new helper (inode_nohighmem(inode)) needs to be used for pagecache symlinks inodes; done for all in-tree cases. page_follow_link_light() instrumented to yell about anything missed. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -4283,6 +4283,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
|
||||
inode->i_op = &ext4_symlink_inode_operations;
|
||||
ext4_set_aops(inode);
|
||||
}
|
||||
inode_nohighmem(inode);
|
||||
} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
|
||||
S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
|
||||
inode->i_op = &ext4_special_inode_operations;
|
||||
|
@@ -3132,6 +3132,7 @@ static int ext4_symlink(struct inode *dir,
|
||||
if ((disk_link.len > EXT4_N_BLOCKS * 4)) {
|
||||
if (!encryption_required)
|
||||
inode->i_op = &ext4_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
ext4_set_aops(inode);
|
||||
/*
|
||||
* We cannot call page_symlink() with transaction started
|
||||
|
@@ -45,7 +45,7 @@ static const char *ext4_encrypted_follow_link(struct dentry *dentry, void **cook
|
||||
cpage = read_mapping_page(inode->i_mapping, 0, NULL);
|
||||
if (IS_ERR(cpage))
|
||||
return ERR_CAST(cpage);
|
||||
caddr = kmap(cpage);
|
||||
caddr = page_address(cpage);
|
||||
caddr[size] = 0;
|
||||
}
|
||||
|
||||
@@ -75,16 +75,12 @@ static const char *ext4_encrypted_follow_link(struct dentry *dentry, void **cook
|
||||
/* Null-terminate the name */
|
||||
if (res <= plen)
|
||||
paddr[res] = '\0';
|
||||
if (cpage) {
|
||||
kunmap(cpage);
|
||||
if (cpage)
|
||||
page_cache_release(cpage);
|
||||
}
|
||||
return *cookie = paddr;
|
||||
errout:
|
||||
if (cpage) {
|
||||
kunmap(cpage);
|
||||
if (cpage)
|
||||
page_cache_release(cpage);
|
||||
}
|
||||
kfree(paddr);
|
||||
return ERR_PTR(res);
|
||||
}
|
||||
|
Reference in New Issue
Block a user