From: KaiGai Kohei <kaigai@ak.jp.nec.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: KaiGai Kohei <kaigai@ak.jp.nec.com>, Adrian Bunk <bunk@stusta.de>,
jffs-dev@axis.com, linux-kernel@vger.kernel.org
Subject: Re: unused fs/jffs2/acl.c:jffs2_clear_acl()
Date: Sun, 02 Jul 2006 23:08:09 +0900 [thread overview]
Message-ID: <44A7D349.4040705@ak.jp.nec.com> (raw)
In-Reply-To: <44A3E354.6050001@ak.jp.nec.com>
[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]
[JFFS2][XATTR] Fix memory leak in POSIX-ACL support
* jffs2-xattr-v6.2-02-fix-posix_acl-memory-leak.patch
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@ak.jp.nec.com>
Thanks,
KaiGai Kohei wrote:
> David Woodhouse wrote:
>
>>On Thu, 2006-06-29 at 15:01 +0200, Adrian Bunk wrote:
>>
>>
>>>it might not have been intended that jffs2_clear_acl() in Linus' tree
>>>is unused?
>>
>>
>>I suspect you're right -- thanks for pointing it out.
>>
>>Kaigai-san?
>
>
> I'm sorry, it's a serious BUG.
> When an inode is cleared, jffs2_clear_acl() should be called
> to release on-memory ACL. Because the current implementation
> didn't care about this cleaning-up, we have memory-leaking.
>
> Please wait a patch for a while.
>
> Thanks,
--
KaiGai Kohei <kaigai@kaigai.gr.jp>
[-- Attachment #2: jffs2-xattr-v6.2-02-fix-posix_acl-memory-leak.patch --]
[-- Type: text/plain, Size: 1702 bytes --]
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 9c2077e..0ae3cd1 100644
--- a/fs/jffs2/acl.c
+++ b/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 --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h
index 8893bd1..fa327db 100644
--- a/fs/jffs2/acl.h
+++ b/fs/jffs2/acl.h
@@ -30,7 +30,7 @@ #define JFFS2_ACL_NOT_CACHED ((void *)-1
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 @@ #else
#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 --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index cc18992..266423b 100644
--- a/fs/jffs2/readinode.c
+++ b/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;
prev parent reply other threads:[~2006-07-02 14:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-29 13:01 unused fs/jffs2/acl.c:jffs2_clear_acl() Adrian Bunk
2006-06-29 13:16 ` David Woodhouse
2006-06-29 14:27 ` KaiGai Kohei
2006-07-02 14:08 ` KaiGai Kohei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44A7D349.4040705@ak.jp.nec.com \
--to=kaigai@ak.jp.nec.com \
--cc=bunk@stusta.de \
--cc=dwmw2@infradead.org \
--cc=jffs-dev@axis.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox