From: Kangjie Lu Date: Sat, 16 Mar 2019 21:46:05 +0000 (-0500) Subject: net: tipc: fix a missing check for nla_nest_start X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=517ccc2aa50dbd7767a9eb8e1d9987a3ed7ced3e;p=linux.git net: tipc: fix a missing check for nla_nest_start nla_nest_start may fail. The fix check its status and returns -EMSGSIZE in case it fails. Signed-off-by: Kangjie Lu Signed-off-by: David S. Miller --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 3274ef625dba1..d6b26862b34e8 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -3255,6 +3255,8 @@ static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk) peer_port = tsk_peer_port(tsk); nest = nla_nest_start(skb, TIPC_NLA_SOCK_CON); + if (!nest) + return -EMSGSIZE; if (nla_put_u32(skb, TIPC_NLA_CON_NODE, peer_node)) goto msg_full;