public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: bsingharora@gmail.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end()
Date: Tue, 03 Sep 2013 13:07:13 +0800	[thread overview]
Message-ID: <52256E81.8070109@asianux.com> (raw)
In-Reply-To: <5212D810.4040407@asianux.com>

Hello maintainers:

Please help check this patch, when you have time.

Thanks.

On 08/20/2013 10:44 AM, Chen Gang wrote:
> When failure occurs between nla_nest_start() and nla_nest_end(), need
> call nla_nest_cancel() to clean up related things.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  kernel/taskstats.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/taskstats.c b/kernel/taskstats.c
> index 145bb4d..1db6808 100644
> --- a/kernel/taskstats.c
> +++ b/kernel/taskstats.c
> @@ -404,11 +404,15 @@ static struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)
>  	if (!na)
>  		goto err;
>  
> -	if (nla_put(skb, type, sizeof(pid), &pid) < 0)
> +	if (nla_put(skb, type, sizeof(pid), &pid) < 0) {
> +		nla_nest_cancel(skb, na);
>  		goto err;
> +	}
>  	ret = nla_reserve(skb, TASKSTATS_TYPE_STATS, sizeof(struct taskstats));
> -	if (!ret)
> +	if (!ret) {
> +		nla_nest_cancel(skb, na);
>  		goto err;
> +	}
>  	nla_nest_end(skb, na);
>  
>  	return nla_data(ret);
> 


-- 
Chen Gang

  reply	other threads:[~2013-09-03  5:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  2:40 [PATCH] kernel/delayacct.c: check NULL for member variable 'delays' in all extern functions Chen Gang
2013-08-20  2:44 ` [PATCH] kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end() Chen Gang
2013-09-03  5:07   ` Chen Gang [this message]
2013-08-21 22:10 ` [PATCH] kernel/delayacct.c: check NULL for member variable 'delays' in all extern functions Andrew Morton
2013-08-22  2:17   ` Chen Gang
2013-09-03  5:03     ` [PATCH] kernel/delayacct.c: remove redundancy checking in __delayacct_add_tsk() 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=52256E81.8070109@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.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