Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b228b8e5bf96b740a70871c1a248bb65c267f5f2
Commit:     b228b8e5bf96b740a70871c1a248bb65c267f5f2
Parent:     ad28d94abb1313bdf27e196676292c493f92f824
Author:     Michael Halcrow <[EMAIL PROTECTED]>
AuthorDate: Fri Mar 16 13:38:22 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Mar 16 19:25:05 2007 -0700

    [PATCH] eCryptfs: fix possible NULL ptr deref in ecryptfs_d_release()
    
    ecryptfs_d_release() first dereferences a pointer (via
    ecryptfs_dentry_to_lower()) and then afterwards checks to see if the
    pointer it just dereferenced is NULL (via ecryptfs_dentry_to_private()).
    
    This patch moves all of the work done on the dereferenced pointer inside a
    block governed by the condition that the pointer is non-NULL.
    
    Signed-off-by: Michael Halcrow <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/ecryptfs/dentry.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 329efcd..cb20b96 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -78,18 +78,13 @@ struct kmem_cache *ecryptfs_dentry_info_cache;
  */
 static void ecryptfs_d_release(struct dentry *dentry)
 {
-       struct dentry *lower_dentry;
-
-       lower_dentry = ecryptfs_dentry_to_lower(dentry);
-       if (ecryptfs_dentry_to_private(dentry))
+       if (ecryptfs_dentry_to_private(dentry)) {
+               if (ecryptfs_dentry_to_lower(dentry)) {
+                       mntput(ecryptfs_dentry_to_lower_mnt(dentry));
+                       dput(ecryptfs_dentry_to_lower(dentry));
+               }
                kmem_cache_free(ecryptfs_dentry_info_cache,
                                ecryptfs_dentry_to_private(dentry));
-       if (lower_dentry) {
-               struct vfsmount *lower_mnt =
-                       ecryptfs_dentry_to_lower_mnt(dentry);
-
-               mntput(lower_mnt);
-               dput(lower_dentry);
        }
        return;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to