Re: [PATCH] kernel: auditfilter: looping issue, memory leak if has2 or more AUDIT_FILTERKEYs
From: Chen Gang
Date: Wed Apr 10 2013 - 06:28:57 EST
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.
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.
> 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@xxxxxxxxxxx>
>> 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)
>> case AUDIT_FILTERKEY:
>> + if (new->filterkey)
>> + break;
>> fk = kstrdup(old->filterkey, GFP_KERNEL);
>> if (unlikely(!fk))
>> err = -ENOMEM;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/