summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2018-12-26 00:09:04 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 15:37:50 +0100
commit709f50b180528ad1e89d9a8ad59cc81a85937bb8 (patch)
treeb05a1eb728d6725a40f343c2ea67175d2aedb0bc /net
parenta4bc476bd09e09d8f854dd8b7dcb60cb0c4dfafe (diff)
tipc: fix a missing check of genlmsg_put
[ Upstream commit 46273cf7e009231d2b6bc10a926e82b8928a9fb2 ] genlmsg_put could fail. The fix inserts a check of its return value, and if it fails, returns -EMSGSIZE. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/netlink_compat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 1c8ac0c11008..91d51a595ac2 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -974,6 +974,8 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock)
hdr = genlmsg_put(args, 0, 0, &tipc_genl_family, NLM_F_MULTI,
TIPC_NL_PUBL_GET);
+ if (!hdr)
+ return -EMSGSIZE;
nest = nla_nest_start(args, TIPC_NLA_SOCK);
if (!nest) {