mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] taskstats: free skb, avoid returns in send_cpu_listeners
Add a missing freeing of skb in the case there are no listeners at all. Also remove the returning of error values by the function as it is unused by the sole caller. Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com> Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7d94dddd43
commit
d94a041519
1 changed files with 11 additions and 13 deletions
|
@ -121,46 +121,45 @@ static int send_reply(struct sk_buff *skb, pid_t pid)
|
||||||
/*
|
/*
|
||||||
* Send taskstats data in @skb to listeners registered for @cpu's exit data
|
* Send taskstats data in @skb to listeners registered for @cpu's exit data
|
||||||
*/
|
*/
|
||||||
static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
|
static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data);
|
struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data);
|
||||||
struct listener_list *listeners;
|
struct listener_list *listeners;
|
||||||
struct listener *s, *tmp;
|
struct listener *s, *tmp;
|
||||||
struct sk_buff *skb_next, *skb_cur = skb;
|
struct sk_buff *skb_next, *skb_cur = skb;
|
||||||
void *reply = genlmsg_data(genlhdr);
|
void *reply = genlmsg_data(genlhdr);
|
||||||
int rc, ret, delcount = 0;
|
int rc, delcount = 0;
|
||||||
|
|
||||||
rc = genlmsg_end(skb, reply);
|
rc = genlmsg_end(skb, reply);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
nlmsg_free(skb);
|
nlmsg_free(skb);
|
||||||
return rc;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
listeners = &per_cpu(listener_array, cpu);
|
listeners = &per_cpu(listener_array, cpu);
|
||||||
down_read(&listeners->sem);
|
down_read(&listeners->sem);
|
||||||
list_for_each_entry_safe(s, tmp, &listeners->list, list) {
|
list_for_each_entry(s, &listeners->list, list) {
|
||||||
skb_next = NULL;
|
skb_next = NULL;
|
||||||
if (!list_is_last(&s->list, &listeners->list)) {
|
if (!list_is_last(&s->list, &listeners->list)) {
|
||||||
skb_next = skb_clone(skb_cur, GFP_KERNEL);
|
skb_next = skb_clone(skb_cur, GFP_KERNEL);
|
||||||
if (!skb_next) {
|
if (!skb_next)
|
||||||
nlmsg_free(skb_cur);
|
|
||||||
rc = -ENOMEM;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ret = genlmsg_unicast(skb_cur, s->pid);
|
rc = genlmsg_unicast(skb_cur, s->pid);
|
||||||
if (ret == -ECONNREFUSED) {
|
if (rc == -ECONNREFUSED) {
|
||||||
s->valid = 0;
|
s->valid = 0;
|
||||||
delcount++;
|
delcount++;
|
||||||
rc = ret;
|
|
||||||
}
|
}
|
||||||
skb_cur = skb_next;
|
skb_cur = skb_next;
|
||||||
}
|
}
|
||||||
up_read(&listeners->sem);
|
up_read(&listeners->sem);
|
||||||
|
|
||||||
|
if (skb_cur)
|
||||||
|
nlmsg_free(skb_cur);
|
||||||
|
|
||||||
if (!delcount)
|
if (!delcount)
|
||||||
return rc;
|
return;
|
||||||
|
|
||||||
/* Delete invalidated entries */
|
/* Delete invalidated entries */
|
||||||
down_write(&listeners->sem);
|
down_write(&listeners->sem);
|
||||||
|
@ -171,7 +170,6 @@ static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_write(&listeners->sem);
|
up_write(&listeners->sem);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fill_pid(pid_t pid, struct task_struct *pidtsk,
|
static int fill_pid(pid_t pid, struct task_struct *pidtsk,
|
||||||
|
|
Loading…
Reference in a new issue