aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_ioctl.c')
-rw-r--r--net/bridge/br_ioctl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index eeee218eed80..3ec1c636e620 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -21,12 +21,12 @@
21#include "br_private.h" 21#include "br_private.h"
22 22
23/* called with RTNL */ 23/* called with RTNL */
24static int get_bridge_ifindices(int *indices, int num) 24static int get_bridge_ifindices(struct net *net, int *indices, int num)
25{ 25{
26 struct net_device *dev; 26 struct net_device *dev;
27 int i = 0; 27 int i = 0;
28 28
29 for_each_netdev(&init_net, dev) { 29 for_each_netdev(net, dev) {
30 if (i >= num) 30 if (i >= num)
31 break; 31 break;
32 if (dev->priv_flags & IFF_EBRIDGE) 32 if (dev->priv_flags & IFF_EBRIDGE)
@@ -89,7 +89,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
89 if (!capable(CAP_NET_ADMIN)) 89 if (!capable(CAP_NET_ADMIN))
90 return -EPERM; 90 return -EPERM;
91 91
92 dev = dev_get_by_index(&init_net, ifindex); 92 dev = dev_get_by_index(dev_net(br->dev), ifindex);
93 if (dev == NULL) 93 if (dev == NULL)
94 return -EINVAL; 94 return -EINVAL;
95 95
@@ -309,7 +309,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
309 return -EOPNOTSUPP; 309 return -EOPNOTSUPP;
310} 310}
311 311
312static int old_deviceless(void __user *uarg) 312static int old_deviceless(struct net *net, void __user *uarg)
313{ 313{
314 unsigned long args[3]; 314 unsigned long args[3];
315 315
@@ -331,7 +331,7 @@ static int old_deviceless(void __user *uarg)
331 if (indices == NULL) 331 if (indices == NULL)
332 return -ENOMEM; 332 return -ENOMEM;
333 333
334 args[2] = get_bridge_ifindices(indices, args[2]); 334 args[2] = get_bridge_ifindices(net, indices, args[2]);
335 335
336 ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int)) 336 ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int))
337 ? -EFAULT : args[2]; 337 ? -EFAULT : args[2];
@@ -354,9 +354,9 @@ static int old_deviceless(void __user *uarg)
354 buf[IFNAMSIZ-1] = 0; 354 buf[IFNAMSIZ-1] = 0;
355 355
356 if (args[0] == BRCTL_ADD_BRIDGE) 356 if (args[0] == BRCTL_ADD_BRIDGE)
357 return br_add_bridge(buf); 357 return br_add_bridge(net, buf);
358 358
359 return br_del_bridge(buf); 359 return br_del_bridge(net, buf);
360 } 360 }
361 } 361 }
362 362
@@ -368,7 +368,7 @@ int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user *uar
368 switch (cmd) { 368 switch (cmd) {
369 case SIOCGIFBR: 369 case SIOCGIFBR:
370 case SIOCSIFBR: 370 case SIOCSIFBR:
371 return old_deviceless(uarg); 371 return old_deviceless(net, uarg);
372 372
373 case SIOCBRADDBR: 373 case SIOCBRADDBR:
374 case SIOCBRDELBR: 374 case SIOCBRDELBR:
@@ -383,9 +383,9 @@ int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user *uar
383 383
384 buf[IFNAMSIZ-1] = 0; 384 buf[IFNAMSIZ-1] = 0;
385 if (cmd == SIOCBRADDBR) 385 if (cmd == SIOCBRADDBR)
386 return br_add_bridge(buf); 386 return br_add_bridge(net, buf);
387 387
388 return br_del_bridge(buf); 388 return br_del_bridge(net, buf);
389 } 389 }
390 } 390 }
391 return -EOPNOTSUPP; 391 return -EOPNOTSUPP;