[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <516CFF2C.7010509@asianux.com>
Date: Tue, 16 Apr 2013 15:35:08 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Eric Paris <eparis@...hat.com>, Al Viro <viro@...iv.linux.org.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel: audit_tree: resource management: need put_tree
and goto Err when failure occures
oh, sorry, this patch need improving (got --> goto)
and I should compile, install, running in normal condition, and be
sure of no additional issues occur at least.
On 2013年04月12日 12:43, Chen Gang wrote:
>
> since "normally audit_add_tree_rule() will free it on failure",
> need free it completely, when failure occures.
>
> need additional put_tree before return, since get_tree was called.
> always need goto error processing area for list_del_init.
>
> Signed-off-by: Chen Gang <gang.chen@...anux.com>
> ---
> kernel/audit_tree.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
> index 642a89c..3729d49 100644
> --- a/kernel/audit_tree.c
> +++ b/kernel/audit_tree.c
> @@ -694,13 +694,15 @@ int audit_add_tree_rule(struct audit_krule *rule)
> spin_unlock(&hash_lock);
> } else {
> trim_marked(tree);
> + put_tree(tree);
> goto Err;
> }
>
> mutex_lock(&audit_filter_mutex);
> if (list_empty(&rule->rlist)) {
> put_tree(tree);
> - return -ENOENT;
> + err = -ENOENT;
> + got Err1;
> }
> rule->tree = tree;
> put_tree(tree);
> @@ -708,6 +710,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
> return 0;
> Err:
> mutex_lock(&audit_filter_mutex);
> +Err1:
> list_del_init(&tree->list);
> list_del_init(&tree->rules);
> put_tree(tree);
>
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists