[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <fbdc1e8c6b79ebdca8d9d81e5f53b4913c4c3e4e.1399388943.git.popovich_sergei@mail.ru>
Date: Tue, 6 May 2014 18:13:15 +0300
From: Sergey Popovich <popovich_sergei@...l.ru>
To: netdev@...r.kernel.org
Subject: [PATCH 1/3] rtnetlink: walk through all devs in netns safely on link params change
Changing parameters of group of network interfaces may lead to
system hang during change, caused by unsafe walking through
list of network interfaces in current network namespace.
This could be easily reproduced with following configuration:
# ip netns add pc10
# ip link add dev dummy128 group 128 type dummy
# ip link set group 128 netns pc10
Fixes: e7ed828f10bd netlink: support setting devgroup parameters
Signed-off-by: Sergey Popovich <popovich_sergei@...l.ru>
---
net/core/rtnetlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d4ff417..95258e2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1782,10 +1782,10 @@ static int rtnl_group_changelink(struct net *net, int group,
struct ifinfomsg *ifm,
struct nlattr **tb)
{
- struct net_device *dev;
+ struct net_device *dev, *aux;
int err;
- for_each_netdev(net, dev) {
+ for_each_netdev_safe(net, dev, aux) {
if (dev->group == group) {
err = do_setlink(dev, ifm, tb, NULL, 0);
if (err < 0)
--
1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists