taskstats: handle NULL nla case in taskstats2
Avoid NULL dereference in taskstats2_foreach. Fixes: 75aad5da3593 ("taskstats: add a option to send all tasks data to user") Change-Id: I0c1860c003b73bcecee7a7c7db2939668517ac82 Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org> Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
This commit is contained in:
parent
acffd6f45a
commit
262e96de91
@ -793,6 +793,10 @@ static int taskstats2_foreach(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
nla = nla_find(nlmsg_attrdata(cb->nlh, GENL_HDRLEN),
|
||||
nlmsg_attrlen(cb->nlh, GENL_HDRLEN),
|
||||
TASKSTATS_TYPE_FOREACH);
|
||||
|
||||
if (!nla)
|
||||
goto out;
|
||||
|
||||
buf = nla_get_u32(nla);
|
||||
oom_score_min = (short) (buf & 0xFFFF);
|
||||
oom_score_max = (short) ((buf >> 16) & 0xFFFF);
|
||||
@ -850,6 +854,7 @@ static int taskstats2_foreach(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
}
|
||||
|
||||
cb->args[0] = iter.tgid;
|
||||
out:
|
||||
return skb->len;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user