mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
eCryptfs: do not try to open device files on mknod
When creating device nodes, eCryptfs needs to delay actually opening the lower persistent file until an application tries to open. Device handles may not be backed by anything when they first come into existence. [Valdis.Kletnieks@vt.edu: build fix] Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Cc: <Valdis.Kletnieks@vt.edu} Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0a688ad713
commit
72b55fffd6
4 changed files with 42 additions and 13 deletions
|
@ -199,6 +199,20 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
|
|||
"file must hence be opened RO\n", __func__);
|
||||
goto out;
|
||||
}
|
||||
if (!ecryptfs_inode_to_private(inode)->lower_file) {
|
||||
BUG_ON(!(crypt_stat->flags & ECRYPTFS_DELAY_PERSISTENT));
|
||||
mutex_lock(&crypt_stat->cs_mutex);
|
||||
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
|
||||
mutex_unlock(&crypt_stat->cs_mutex);
|
||||
rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error attempting to initialize "
|
||||
"the persistent file for the dentry with name "
|
||||
"[%s]; rc = [%d]\n", __func__,
|
||||
ecryptfs_dentry->d_name.name, rc);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
ecryptfs_set_file_lower(
|
||||
file, ecryptfs_inode_to_private(inode)->lower_file);
|
||||
if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue