aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_netlink.c')
-rw-r--r--net/bridge/br_netlink.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 53ab8e0cb518..f5d69336d97b 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
18static inline size_t br_nlmsg_size(void) 19static inline size_t br_nlmsg_size(void)
@@ -96,10 +97,10 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
96 kfree_skb(skb); 97 kfree_skb(skb);
97 goto errout; 98 goto errout;
98 } 99 }
99 err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); 100 err = rtnl_notify(skb, &init_net,0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
100errout: 101errout:
101 if (err < 0) 102 if (err < 0)
102 rtnl_set_sk_err(RTNLGRP_LINK, err); 103 rtnl_set_sk_err(&init_net, RTNLGRP_LINK, err);
103} 104}
104 105
105/* 106/*
@@ -107,9 +108,13 @@ errout:
107 */ 108 */
108static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 109static 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 */
136static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 141static 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