+ jffs2-xattr-fix-memory-leak-in-posix-acl-support.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     jffs2 xattr: fix memory leak in POSIX-ACL support

has been added to the -mm tree.  Its filename is

     jffs2-xattr-fix-memory-leak-in-posix-acl-support.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: jffs2 xattr: fix memory leak in POSIX-ACL support
From: KaiGai Kohei <kaigai@xxxxxxxxxxxxx>

jffs2_clear_acl() which releases acl caches allocated by kmalloc() was
defined but it was never called.  Thus, we faced to the risk of memory
leaking.

This patch plugs jffs2_clear_acl() into jffs2_do_clear_inode().  It ensures
to release acl cache when inode is cleared.

Signed-off-by: KaiGai Kohei <kaigai@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/jffs2/acl.c       |    4 +---
 fs/jffs2/acl.h       |    4 ++--
 fs/jffs2/readinode.c |    1 +
 3 files changed, 4 insertions(+), 5 deletions(-)

diff -puN fs/jffs2/acl.c~jffs2-xattr-fix-memory-leak-in-posix-acl-support fs/jffs2/acl.c
--- a/fs/jffs2/acl.c~jffs2-xattr-fix-memory-leak-in-posix-acl-support
+++ a/fs/jffs2/acl.c
@@ -345,10 +345,8 @@ int jffs2_init_acl(struct inode *inode, 
 	return rc;
 }
 
-void jffs2_clear_acl(struct inode *inode)
+void jffs2_clear_acl(struct jffs2_inode_info *f)
 {
-	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-
 	if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) {
 		posix_acl_release(f->i_acl_access);
 		f->i_acl_access = JFFS2_ACL_NOT_CACHED;
diff -puN fs/jffs2/acl.h~jffs2-xattr-fix-memory-leak-in-posix-acl-support fs/jffs2/acl.h
--- a/fs/jffs2/acl.h~jffs2-xattr-fix-memory-leak-in-posix-acl-support
+++ a/fs/jffs2/acl.h
@@ -30,7 +30,7 @@ struct jffs2_acl_header {
 extern int jffs2_permission(struct inode *, int, struct nameidata *);
 extern int jffs2_acl_chmod(struct inode *);
 extern int jffs2_init_acl(struct inode *, struct inode *);
-extern void jffs2_clear_acl(struct inode *);
+extern void jffs2_clear_acl(struct jffs2_inode_info *);
 
 extern struct xattr_handler jffs2_acl_access_xattr_handler;
 extern struct xattr_handler jffs2_acl_default_xattr_handler;
@@ -40,6 +40,6 @@ extern struct xattr_handler jffs2_acl_de
 #define jffs2_permission NULL
 #define jffs2_acl_chmod(inode)		(0)
 #define jffs2_init_acl(inode,dir)	(0)
-#define jffs2_clear_acl(inode)
+#define jffs2_clear_acl(f)
 
 #endif	/* CONFIG_JFFS2_FS_POSIX_ACL */
diff -puN fs/jffs2/readinode.c~jffs2-xattr-fix-memory-leak-in-posix-acl-support fs/jffs2/readinode.c
--- a/fs/jffs2/readinode.c~jffs2-xattr-fix-memory-leak-in-posix-acl-support
+++ a/fs/jffs2/readinode.c
@@ -968,6 +968,7 @@ void jffs2_do_clear_inode(struct jffs2_s
 	struct jffs2_full_dirent *fd, *fds;
 	int deleted;
 
+	jffs2_clear_acl(f);
 	jffs2_xattr_delete_inode(c, f->inocache);
 	down(&f->sem);
 	deleted = f->inocache && !f->inocache->nlink;
_

Patches currently in -mm which might be from kaigai@xxxxxxxxxxxxx are

origin.patch
git-mtd.patch
jffs2-xattr-fix-memory-leak-in-posix-acl-support.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux