summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2018-12-26 00:09:04 -0600
committerDavid S. Miller <davem@davemloft.net>2018-12-27 16:26:09 -0800
commit46273cf7e009231d2b6bc10a926e82b8928a9fb2 (patch)
tree73bf3ea3c86d358981738515f96ca11dc4447f15 /net/tipc
parentff07d48d7bc0974d4f96a85a4df14564fb09f1ef (diff)
downloadlinux-46273cf7e009231d2b6bc10a926e82b8928a9fb2.tar.bz2
tipc: fix a missing check of genlmsg_put
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>
Diffstat (limited to 'net/tipc')
-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 21f6ccc89401..40f5cae623a7 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -904,6 +904,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) {