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

Commit 4b1c7d07 authored by Jin Qian's avatar Jin Qian
Browse files

ANDROID: ext4: don't put symlink in pagecache into highmem



This is a partial backport of 21fc61c73c3903c4c312d0802da01ec2b323d174.

ext4_encrypted_follow_link uses kmap() for cpage
  caddr = kmap(cpage);

_ext4_fname_disk_to_usr calls virt_to_page on the kmapped address.
  _ext4_fname_disk_to_usr()
    ext4_fname_decrypt()
      sg_init_one()
        sg_init_one(&src_sg, iname->name, iname->len);
          sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));

Bug: 71602077
Change-Id: If86e58dd6126dbe5dd6a234d7ffe71bb638a07cd
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJin Qian <jinqian@google.com>
parent 94032db8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4342,6 +4342,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;
+1 −0
Original line number Diff line number Diff line
@@ -3132,6 +3132,7 @@ static int ext4_symlink(struct inode *dir,

	if ((disk_link.len > EXT4_N_BLOCKS * 4)) {
		inode->i_op = &ext4_symlink_inode_operations;
		inode_nohighmem(inode);
		ext4_set_aops(inode);
		/*
		 * We cannot call page_symlink() with transaction started
+3 −7
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
		cpage = read_mapping_page(inode->i_mapping, 0, NULL);
		if (IS_ERR(cpage))
			return cpage;
		caddr = kmap(cpage);
		caddr = page_address(cpage);
		caddr[size] = 0;
	}

@@ -80,16 +80,12 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
	if (res <= plen)
		paddr[res] = '\0';
	nd_set_link(nd, paddr);
	if (cpage) {
		kunmap(cpage);
	if (cpage)
		page_cache_release(cpage);
	}
	return NULL;
errout:
	if (cpage) {
		kunmap(cpage);
	if (cpage)
		page_cache_release(cpage);
	}
	kfree(paddr);
	return ERR_PTR(res);
}
+0 −5
Original line number Diff line number Diff line
@@ -201,11 +201,6 @@ static inline struct dentry *file_dentry(const struct file *file)
	return file->f_path.dentry;
}

static inline void inode_nohighmem(struct inode *inode)
{
	mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
}

/**
 * current_time - Return FS time
 * @inode: inode.
+6 −0
Original line number Diff line number Diff line
@@ -1951,3 +1951,9 @@ void inode_set_flags(struct inode *inode, unsigned int flags,
				  new_flags) != old_flags));
}
EXPORT_SYMBOL(inode_set_flags);

void inode_nohighmem(struct inode *inode)
{
	mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
}
EXPORT_SYMBOL(inode_nohighmem);
Loading