Commit c10c63ea authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller

macsec: take rtnl lock before for_each_netdev

Fixes: c09440f7 ("macsec: introduce IEEE 802.1AE driver")
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72f2a05b
......@@ -2268,8 +2268,6 @@ static int dump_secy(struct macsec_secy *secy, struct net_device *dev,
if (!hdr)
return -EMSGSIZE;
rtnl_lock();
if (nla_put_u32(skb, MACSEC_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;
......@@ -2429,14 +2427,11 @@ static int dump_secy(struct macsec_secy *secy, struct net_device *dev,
nla_nest_end(skb, rxsc_list);
rtnl_unlock();
genlmsg_end(skb, hdr);
return 0;
nla_put_failure:
rtnl_unlock();
genlmsg_cancel(skb, hdr);
return -EMSGSIZE;
}
......@@ -2450,6 +2445,7 @@ static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb)
dev_idx = cb->args[0];
d = 0;
rtnl_lock();
for_each_netdev(net, dev) {
struct macsec_secy *secy;
......@@ -2467,6 +2463,7 @@ static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb)
}
done:
rtnl_unlock();
cb->args[0] = d;
return skb->len;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment