提交 43a43b60 编写于 作者: H Hannes Frederic Sowa 提交者: David S. Miller

ipv6: some ipv6 statistic counters failed to disable bh

After commit c15b1cca ("ipv6: move DAD and addrconf_verify
processing to workqueue") some counters are now updated in process context
and thus need to disable bh before doing so, otherwise deadlocks can
happen on 32-bit archs. Fabio Estevam noticed this while while mounting
a NFS volume on an ARM board.

As a compensation for missing this I looked after the other *_STATS_BH
and found three other calls which need updating:

1) icmp6_send: ip6_fragment -> icmpv6_send -> icmp6_send (error handling)
2) ip6_push_pending_frames: rawv6_sendmsg -> rawv6_push_pending_frames -> ...
   (only in case of icmp protocol with raw sockets in error handling)
3) ping6_v6_sendmsg (error handling)

Fixes: c15b1cca ("ipv6: move DAD and addrconf_verify processing to workqueue")
Reported-by: NFabio Estevam <festevam@gmail.com>
Tested-by: NFabio Estevam <fabio.estevam@freescale.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 44934fac
...@@ -520,7 +520,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) ...@@ -520,7 +520,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
np->tclass, NULL, &fl6, (struct rt6_info *)dst, np->tclass, NULL, &fl6, (struct rt6_info *)dst,
MSG_DONTWAIT, np->dontfrag); MSG_DONTWAIT, np->dontfrag);
if (err) { if (err) {
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS); ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk); ip6_flush_pending_frames(sk);
} else { } else {
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
......
...@@ -1567,8 +1567,8 @@ int ip6_push_pending_frames(struct sock *sk) ...@@ -1567,8 +1567,8 @@ int ip6_push_pending_frames(struct sock *sk)
if (proto == IPPROTO_ICMPV6) { if (proto == IPPROTO_ICMPV6) {
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type); ICMP6MSGOUT_INC_STATS(net, idev, icmp6_hdr(skb)->icmp6_type);
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
} }
err = ip6_local_out(skb); err = ip6_local_out(skb);
......
...@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb) ...@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
dst_output); dst_output);
out: out:
if (!err) { if (!err) {
ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT); ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len); IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
} else } else {
IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
}
rcu_read_unlock(); rcu_read_unlock();
return; return;
......
...@@ -182,7 +182,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -182,7 +182,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
MSG_DONTWAIT, np->dontfrag); MSG_DONTWAIT, np->dontfrag);
if (err) { if (err) {
ICMP6_INC_STATS_BH(sock_net(sk), rt->rt6i_idev, ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
ICMP6_MIB_OUTERRORS); ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk); ip6_flush_pending_frames(sk);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册