summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-11-05 16:57:37 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-11-05 16:57:37 +1100
commit03624ad9ae0fd157a9501e05efe3baf51becc89d (patch)
tree967b1f047a8a5614db576090759aedf423abfffd /kernel
parent88d826faf48260901bdd516c294494d25b5af6bc (diff)
kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end()
When failure occurs between nla_nest_start() and nla_nest_end(), we should call nla_nest_cancel() to clean up related things. Signed-off-by: Chen Gang <gang.chen@asianux.com> Cc: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/taskstats.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 145bb4d3bd4d..1db6808c494b 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);