]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/tipc/netlink_compat.c
tipc: fix memory leak in tipc_nl_compat_publ_dump
[linux.git] / net / tipc / netlink_compat.c
index 6376467e78f862c25ffae531848bd7aded07609e..77e4b2418f302555acac4813d3baa39b356e632e 100644 (file)
@@ -904,6 +904,10 @@ 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) {
+               kfree_skb(args);
+               return -EMSGSIZE;
+       }
 
        nest = nla_nest_start(args, TIPC_NLA_SOCK);
        if (!nest) {
@@ -951,8 +955,11 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
                u32 node;
                struct nlattr *con[TIPC_NLA_CON_MAX + 1];
 
-               nla_parse_nested(con, TIPC_NLA_CON_MAX,
-                                sock[TIPC_NLA_SOCK_CON], NULL, NULL);
+               err = nla_parse_nested(con, TIPC_NLA_CON_MAX,
+                                      sock[TIPC_NLA_SOCK_CON], NULL, NULL);
+
+               if (err)
+                       return err;
 
                node = nla_get_u32(con[TIPC_NLA_CON_NODE]);
                tipc_tlv_sprintf(msg->rep, "  connected to <%u.%u.%u:%u>",