summaryrefslogtreecommitdiffstats
path: root/net/tipc/group.c
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-15 18:11:59 +0100
committerDavid S. Miller <davem@davemloft.net>2019-03-16 20:09:05 +0100
commit4589e28db46ee4961edfd794c5bb43887d38c8e5 (patch)
tree68b9946a8bf4651fa74a47f29a6551b6a70a0ef6 /net/tipc/group.c
parentnet: ncsi: fix a missing check for nla_nest_start (diff)
downloadlinux-4589e28db46ee4961edfd794c5bb43887d38c8e5.tar.xz
linux-4589e28db46ee4961edfd794c5bb43887d38c8e5.zip
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 <kjlu@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/tipc/group.c3
1 files changed, 3 insertions, 0 deletions
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,