Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=36f97bc617e2c31d16b74e89cd2406de4d24ede5
Commit:     36f97bc617e2c31d16b74e89cd2406de4d24ede5
Parent:     71053fb1c645e86feb48051d6a4c58b8f2b26806
Author:     Julia Lawall <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 6 17:50:34 2008 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Tue Jan 8 07:48:58 2008 +0000

    [JFFS2] Add missing call to posix_acl_release
    
    posix_acl_clone does a memory allocation and sets a reference count, so
    posix_acl_release is needed afterwards to free it.
    
    The problem was fixed using the following semantic patch.
    (http://www.emn.fr/x-info/coccinelle/)
    
    // <smpl>
    @@
    type T;
    identifier E;
    expression E1, E2;
    int ret;
    statement S;
    @@
    
      T E;
      <+...
    (
      E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...);
      if (E == NULL) S
    |
      if ((E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...)) == 
NULL) S
    )
      ... when != E2 = E
          when strict
    (
      posix_acl_release(E);
    |
      E1 = E;
    |
    + posix_acl_release(E);
      return;
    |
    + posix_acl_release(E);
      return ret;
    )
      ...+>
    // </smpl>
    
    Signed-off-by: Julia Lawall <[EMAIL PROTECTED]>
    Acked-by: KaiGai Kohei <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 fs/jffs2/acl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 993ddfc..4c80404 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -345,8 +345,10 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode 
*inode, int *i_mode)
                if (!clone)
                        return -ENOMEM;
                rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
-               if (rc < 0)
+               if (rc < 0) {
+                       posix_acl_release(clone);
                        return rc;
+               }
                if (rc > 0)
                        jffs2_iset_acl(inode, &f->i_acl_access, clone);
 
-
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