From: Chen Gang <gang.chen@asianux.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Paris <eparis@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] kernel: audit_tree: resource management: need put_tree and goto Err when failure occures
Date: Fri, 10 May 2013 10:08:14 +0800 [thread overview]
Message-ID: <518C568E.2040203@asianux.com> (raw)
In-Reply-To: <20130509131108.8a70aa5116ff0e3c250feb8b@linux-foundation.org>
On 05/10/2013 04:11 AM, Andrew Morton wrote:
>> > But we need let 'rule->tree = NULL;' firstly, so can protect rule itself freed in kill_rules().
> I'll believe you ;) I turned this into a proper patch and added your
> (missed) Signed-off-by:.
>
Thanks.
At least, let 'rule->tree = NULL;' can:
a. it matches 'rule->tree = tree;' which is before successful return.
also can make 'if (list_empty(&rule->rlist))' reasonable.
b. protect rule itself freed in kill_rules(), if it could happen.
just like all 'rule->tree = NULL;' in audit_remove_tree_rule().
c. it will no negative effect.
>> > For me, after 'rule->tree = NULL', all things seems fine !!
> Well, what was wrong before? Is there some user-triggerable
> misbehaviour which you observed? If so, please describe it.
>
>
>
I think, it will cause issue (randomly): if when we are using auditctl
to add rule to monitor one file, and at the same time, the other user is
just deleting this file.
I guess, it is why original code need 'if (list_empty(&rule->rlist))'
after lock 'audit_filter_mutex' again.
Currently, I am just testing for it (and should give a test), and I will
send the test plan and test result within this week (2013-05-12).
Thanks.
--
Chen Gang
Asianux Corporation
next prev parent reply other threads:[~2013-05-10 2:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 9:39 [PATCH] kernel/audit_tree.c: tree will memory leak when failure occurs for audit_trim_trees() Chen Gang
2013-04-22 23:04 ` Andrew Morton
2013-04-23 1:46 ` Chen Gang
2013-05-06 7:41 ` [PATCH kernel-next] kernel/audit_tree.c: fix the original version merging issue for put_tree() Chen Gang
2013-05-09 12:53 ` [PATCH v2] kernel: audit_tree: resource management: need put_tree and goto Err when failure occures Chen Gang
2013-05-09 20:11 ` Andrew Morton
2013-05-10 2:08 ` Chen Gang [this message]
2013-05-10 9:50 ` Chen Gang
2013-05-10 11:29 ` Chen Gang
2013-05-13 2:54 ` Chen Gang
-- strict thread matches above, loose matches on Subject: below --
2013-04-12 4:43 [PATCH] " Chen Gang
2013-04-16 7:35 ` Chen Gang
2013-04-17 4:04 ` [PATCH v2] " Chen Gang
2013-04-17 20:07 ` Andrew Morton
2013-04-18 1:19 ` Chen Gang F T
2013-04-20 7:31 ` Chen Gang
2013-04-23 3:51 ` Chen Gang
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=518C568E.2040203@asianux.com \
--to=gang.chen@asianux.com \
--cc=akpm@linux-foundation.org \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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