aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-01-06 11:50:34 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2008-01-08 02:48:58 -0500
commit36f97bc617e2c31d16b74e89cd2406de4d24ede5 (patch)
tree75df74dfe36f1dc1521bbccbc1f2b7e6b29c76e9 /fs
parent71053fb1c645e86feb48051d6a4c58b8f2b26806 (diff)
[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 <julia@diku.dk> Acked-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/acl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 993ddfce0318..4c80404a9aba 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)
345 if (!clone) 345 if (!clone)
346 return -ENOMEM; 346 return -ENOMEM;
347 rc = posix_acl_create_masq(clone, (mode_t *)i_mode); 347 rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
348 if (rc < 0) 348 if (rc < 0) {
349 posix_acl_release(clone);
349 return rc; 350 return rc;
351 }
350 if (rc > 0) 352 if (rc > 0)
351 jffs2_iset_acl(inode, &f->i_acl_access, clone); 353 jffs2_iset_acl(inode, &f->i_acl_access, clone);
352 354