mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
eCryptfs: Handle NULL nameidata pointers
Allow for NULL nameidata pointers in eCryptfs create, lookup, and d_revalidate functions. Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
This commit is contained in:
parent
8787c7a3e0
commit
70b8902199
3 changed files with 29 additions and 26 deletions
|
@ -74,16 +74,20 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
|
|||
unsigned int flags_save;
|
||||
int rc;
|
||||
|
||||
dentry_save = nd->path.dentry;
|
||||
vfsmount_save = nd->path.mnt;
|
||||
flags_save = nd->flags;
|
||||
nd->path.dentry = lower_dentry;
|
||||
nd->path.mnt = lower_mnt;
|
||||
nd->flags &= ~LOOKUP_OPEN;
|
||||
if (nd) {
|
||||
dentry_save = nd->path.dentry;
|
||||
vfsmount_save = nd->path.mnt;
|
||||
flags_save = nd->flags;
|
||||
nd->path.dentry = lower_dentry;
|
||||
nd->path.mnt = lower_mnt;
|
||||
nd->flags &= ~LOOKUP_OPEN;
|
||||
}
|
||||
rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
|
||||
nd->path.dentry = dentry_save;
|
||||
nd->path.mnt = vfsmount_save;
|
||||
nd->flags = flags_save;
|
||||
if (nd) {
|
||||
nd->path.dentry = dentry_save;
|
||||
nd->path.mnt = vfsmount_save;
|
||||
nd->flags = flags_save;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -241,8 +245,7 @@ out:
|
|||
*/
|
||||
int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
|
||||
struct dentry *lower_dentry,
|
||||
struct inode *ecryptfs_dir_inode,
|
||||
struct nameidata *ecryptfs_nd)
|
||||
struct inode *ecryptfs_dir_inode)
|
||||
{
|
||||
struct dentry *lower_dir_dentry;
|
||||
struct vfsmount *lower_mnt;
|
||||
|
@ -290,8 +293,6 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
|
|||
goto out;
|
||||
if (special_file(lower_inode->i_mode))
|
||||
goto out;
|
||||
if (!ecryptfs_nd)
|
||||
goto out;
|
||||
/* Released in this function */
|
||||
page_virt = kmem_cache_zalloc(ecryptfs_header_cache_2, GFP_USER);
|
||||
if (!page_virt) {
|
||||
|
@ -417,8 +418,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
|
|||
}
|
||||
lookup_and_interpose:
|
||||
rc = ecryptfs_lookup_and_interpose_lower(ecryptfs_dentry, lower_dentry,
|
||||
ecryptfs_dir_inode,
|
||||
ecryptfs_nd);
|
||||
ecryptfs_dir_inode);
|
||||
goto out;
|
||||
out_d_drop:
|
||||
d_drop(ecryptfs_dentry);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue