]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net/netlink_compat: Fix a missing check of nla_parse_nested
authorAditya Pakki <pakki001@umn.edu>
Mon, 24 Dec 2018 00:54:53 +0000 (18:54 -0600)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:36 +0000 (14:21 -0300)
BugLink: https://bugs.launchpad.net/bugs/1855787
[ Upstream commit 89dfd0083751d00d5d7ead36f6d8b045bf89c5e1 ]

In tipc_nl_compat_sk_dump(), if nla_parse_nested() fails, it could return
an error. To be consistent with other invocations of the function call,
on error, the fix passes the return value upstream.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/tipc/netlink_compat.c

index debe9537977ef132a0dbcffd5df03bda49efa49a..7dd6338db4f1efe91f5100397365d1cbaa7f8fc1 100644 (file)
@@ -1023,8 +1023,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>",