Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 262e96de authored by Vinayak Menon's avatar Vinayak Menon Committed by Prakash Gupta
Browse files

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: default avatarVinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
parent acffd6f4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
}