From: Kangjie Lu Date: Fri, 15 Mar 2019 17:11:59 +0000 (-0500) Subject: net: tipc: fix a missing check of nla_nest_start X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~5033^2~65 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=4589e28db46ee4961edfd794c5bb43887d38c8e5;p=linux.git net: tipc: fix a missing check of nla_nest_start nla_nest_start could fail and requires a check. The fix returns -EMSGSIZE if it fails. Signed-off-by: Kangjie Lu Signed-off-by: David S. Miller --- diff --git a/net/tipc/group.c b/net/tipc/group.c index 06fee142f09f..63f39201e41e 100644 --- a/net/tipc/group.c +++ b/net/tipc/group.c @@ -919,6 +919,9 @@ int tipc_group_fill_sock_diag(struct tipc_group *grp, struct sk_buff *skb) { struct nlattr *group = nla_nest_start(skb, TIPC_NLA_SOCK_GROUP); + if (!group) + return -EMSGSIZE; + if (nla_put_u32(skb, TIPC_NLA_SOCK_GROUP_ID, grp->type) || nla_put_u32(skb, TIPC_NLA_SOCK_GROUP_INSTANCE,