mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
42 lines
1.3 KiB
Diff
42 lines
1.3 KiB
Diff
From: Andreas Gruenbacher <agruen@use.de>
|
|
Subject: Check for NULL nameidata in ecryptfs_d_revalidate
|
|
|
|
Some filesystems like nfsd and ecryptfs use lookup_one_len() on other
|
|
filesystems. This causes d_revalidate() calls with nd == NULL through
|
|
__lookup_hash() and cached_lookup(), so we need to check for NULL
|
|
nameidata.
|
|
|
|
Signed-off-by: Andreas Gruenbacher <agruen@use.de>
|
|
Cc: Mike Halcrow <mhalcrow@us.ibm.com>
|
|
Cc: Phillip Hellewell <phillip@hellewell.homeip.net>
|
|
|
|
---
|
|
fs/ecryptfs/dentry.c | 16 ++++++++++------
|
|
1 file changed, 10 insertions(+), 6 deletions(-)
|
|
|
|
--- a/fs/ecryptfs/dentry.c
|
|
+++ b/fs/ecryptfs/dentry.c
|
|
@@ -51,13 +51,17 @@ static int ecryptfs_d_revalidate(struct
|
|
|
|
if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
|
|
goto out;
|
|
- dentry_save = nd->dentry;
|
|
- vfsmount_save = nd->mnt;
|
|
- nd->dentry = lower_dentry;
|
|
- nd->mnt = lower_mnt;
|
|
+ if (nd) {
|
|
+ dentry_save = nd->dentry;
|
|
+ vfsmount_save = nd->mnt;
|
|
+ nd->dentry = lower_dentry;
|
|
+ nd->mnt = lower_mnt;
|
|
+ }
|
|
rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
|
|
- nd->dentry = dentry_save;
|
|
- nd->mnt = vfsmount_save;
|
|
+ if (nd) {
|
|
+ nd->dentry = dentry_save;
|
|
+ nd->mnt = vfsmount_save;
|
|
+ }
|
|
if (dentry->d_inode) {
|
|
struct inode *lower_inode =
|
|
ecryptfs_inode_to_lower(dentry->d_inode);
|