Commit f9615984 authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

kernel/taskstats.c: fix bogus nlmsg_free()

We'd better not nlmsg_free on a pointer containing an undefined value
(and without having anything allocated).

Spotted by the Coverity checker.
Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Acked-by: default avatarBalbir Singh <balbir@linux.vnet.ibm>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4ae44c57
...@@ -398,7 +398,9 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) ...@@ -398,7 +398,9 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]);
file = fget_light(fd, &fput_needed); file = fget_light(fd, &fput_needed);
if (file) { if (!file)
return 0;
size = nla_total_size(sizeof(struct cgroupstats)); size = nla_total_size(sizeof(struct cgroupstats));
rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb,
...@@ -412,17 +414,15 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) ...@@ -412,17 +414,15 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
rc = cgroupstats_build(stats, file->f_dentry); rc = cgroupstats_build(stats, file->f_dentry);
if (rc < 0) if (rc < 0) {
nlmsg_free(rep_skb);
goto err; goto err;
fput_light(file, fput_needed);
return send_reply(rep_skb, info->snd_pid);
} }
rc = send_reply(rep_skb, info->snd_pid);
err: err:
if (file)
fput_light(file, fput_needed); fput_light(file, fput_needed);
nlmsg_free(rep_skb);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment