From: Chen Gang <gang.chen@asianux.com>
To: Al Viro <viro@zeniv.linux.org.uk>, eparis@redhat.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel: auditfilter: looping issue, memory leak if has 2 or more AUDIT_FILTERKEYs
Date: Wed, 10 Apr 2013 18:36:59 +0800 [thread overview]
Message-ID: <516540CB.7090301@asianux.com> (raw)
In-Reply-To: <51653EC2.5030107@asianux.com>
also for function audit_list_rules:
when call audit_make_reply fails (will return NULL).
we also need process data->buf, not only data itself.
please help check, thanks.
:-)
gchen.
On 2013年04月10日 18:28, Chen Gang wrote:
>
> also for function audit_list:
> when call audit_make_reply fails (will return NULL).
> we need free all its related variables instead of only kfree rull.
> (such as call autit_free_rule)
>
> please help check, thanks.
>
> :-)
>
> gchen.
>
> On 2013年04月10日 18:18, Chen Gang wrote:
>>
>>
>> in another function: audit_data_to_entry:
>>
>> a. has the same issue for case AUDIT_WATCH.
>>
>> b. has an new issue for AUDIT_DIR:
>> after AUDIT_DIR succeed, it will set rule->tree.
>> next, the other case fail, then will call audit_free_rule.
>> but audit_free_rule will not free rule->tree.
>>
>>
>> I find them only by reading code, not test them.
>> and I also do not know about the related features.
>> so please help check my 2 opinions whether are correct.
>>
>>
>> welcome any suggestion or completions.
>>
>> thanks.
>>
>> :-)
>>
>>
>> gchen.
>>
>>
>> On 2013年04月10日 17:52, Chen Gang wrote:
>>>
>>> in the 'fcount' looping,
>>> if 'new->fields[*].type" has 2 or more AUDIT_FILTERKEYs
>>> need judge new->filterkey whether has value, or memory leak.
>>>
>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>> ---
>>> kernel/auditfilter.c | 2 ++
>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
>>> index f9fc54b..936ac79 100644
>>> --- a/kernel/auditfilter.c
>>> +++ b/kernel/auditfilter.c
>>> @@ -859,6 +859,8 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old)
>>> &old->fields[i]);
>>> break;
>>> case AUDIT_FILTERKEY:
>>> + if (new->filterkey)
>>> + break;
>>> fk = kstrdup(old->filterkey, GFP_KERNEL);
>>> if (unlikely(!fk))
>>> err = -ENOMEM;
>>>
>>
>>
>
>
--
Chen Gang
Asianux Corporation
next prev parent reply other threads:[~2013-04-10 10:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 9:52 [PATCH] kernel: auditfilter: looping issue, memory leak if has 2 or more AUDIT_FILTERKEYs Chen Gang
2013-04-10 10:18 ` Chen Gang
2013-04-10 10:28 ` Chen Gang
2013-04-10 10:36 ` Chen Gang [this message]
2013-04-10 21:38 ` Eric Paris
2013-04-11 1:12 ` Chen Gang
2013-04-10 21:32 ` Eric Paris
2013-04-11 3:43 ` Chen Gang
2013-04-10 20:29 ` Eric Paris
2013-04-11 3:55 ` Chen Gang
2013-04-10 21:19 ` Eric Paris
2013-04-11 4:10 ` Chen Gang
2013-04-11 13:40 ` Eric Paris
2013-04-11 14:34 ` Chen Gang
2013-04-11 14:52 ` Chen Gang
2013-04-12 9:42 ` Chen Gang
2013-04-16 10:25 ` Chen Gang
2013-04-16 10:38 ` Chen Gang
2013-04-17 2:41 ` Chen Gang
2013-04-17 4:23 ` [PATCH v2] kernel: auditfilter: resource management, tree and watch will memory leak when failure occurs Chen Gang
2013-04-10 20:08 ` [PATCH] kernel: auditfilter: looping issue, memory leak if has 2 or more AUDIT_FILTERKEYs Eric Paris
2013-04-11 3:56 ` 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=516540CB.7090301@asianux.com \
--to=gang.chen@asianux.com \
--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