diff options
Diffstat (limited to 'net/bridge/br_netlink.c')
-rw-r--r-- | net/bridge/br_netlink.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 53ab8e0cb518..a4ffa2b63cd5 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <net/rtnetlink.h> | 14 | #include <net/rtnetlink.h> |
15 | #include <net/net_namespace.h> | 15 | #include <net/net_namespace.h> |
16 | #include <net/sock.h> | ||
16 | #include "br_private.h" | 17 | #include "br_private.h" |
17 | 18 | ||
18 | static inline size_t br_nlmsg_size(void) | 19 | static inline size_t br_nlmsg_size(void) |
@@ -107,9 +108,13 @@ errout: | |||
107 | */ | 108 | */ |
108 | static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | 109 | static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
109 | { | 110 | { |
111 | struct net *net = skb->sk->sk_net; | ||
110 | struct net_device *dev; | 112 | struct net_device *dev; |
111 | int idx; | 113 | int idx; |
112 | 114 | ||
115 | if (net != &init_net) | ||
116 | return 0; | ||
117 | |||
113 | idx = 0; | 118 | idx = 0; |
114 | for_each_netdev(&init_net, dev) { | 119 | for_each_netdev(&init_net, dev) { |
115 | /* not a bridge port */ | 120 | /* not a bridge port */ |
@@ -135,12 +140,16 @@ skip: | |||
135 | */ | 140 | */ |
136 | static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 141 | static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
137 | { | 142 | { |
143 | struct net *net = skb->sk->sk_net; | ||
138 | struct ifinfomsg *ifm; | 144 | struct ifinfomsg *ifm; |
139 | struct nlattr *protinfo; | 145 | struct nlattr *protinfo; |
140 | struct net_device *dev; | 146 | struct net_device *dev; |
141 | struct net_bridge_port *p; | 147 | struct net_bridge_port *p; |
142 | u8 new_state; | 148 | u8 new_state; |
143 | 149 | ||
150 | if (net != &init_net) | ||
151 | return -EINVAL; | ||
152 | |||
144 | if (nlmsg_len(nlh) < sizeof(*ifm)) | 153 | if (nlmsg_len(nlh) < sizeof(*ifm)) |
145 | return -EINVAL; | 154 | return -EINVAL; |
146 | 155 | ||