aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-09-28 15:28:41 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-02 02:22:04 -0400
commit893626d6a353d1356528f94e081246ecf233d77a (patch)
tree821ff67bbcd539aa5dbe7b97066a625dbf5ef95f /net/core/rtnetlink.c
parent7f6d6558ae44bc193eb28df3617c364d3bb6df39 (diff)
rtnetlink: Fail dump if target netnsid is invalid
Link dumps can return results from a target namespace. If the namespace id is invalid, then the dump request should fail if get_target_net fails rather than continuing with a dump of the current namespace. Fixes: 79e1ad148c844 ("rtnetlink: use netnsid to query interface") Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 63ce2283a456..7f37fe9c65a5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1898,10 +1898,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1898 if (tb[IFLA_IF_NETNSID]) { 1898 if (tb[IFLA_IF_NETNSID]) {
1899 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]); 1899 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);
1900 tgt_net = get_target_net(skb->sk, netnsid); 1900 tgt_net = get_target_net(skb->sk, netnsid);
1901 if (IS_ERR(tgt_net)) { 1901 if (IS_ERR(tgt_net))
1902 tgt_net = net; 1902 return PTR_ERR(tgt_net);
1903 netnsid = -1;
1904 }
1905 } 1903 }
1906 1904
1907 if (tb[IFLA_EXT_MASK]) 1905 if (tb[IFLA_EXT_MASK])