Skip to content

Commit 60fe3f6

Browse files
strssndktnJiri Slaby
authored and
Jiri Slaby
committed
ipv6: some ipv6 statistic counters failed to disable bh
[ Upstream commit 43a43b6 ] After commit c15b1cc ("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: c15b1cc ("ipv6: move DAD and addrconf_verify processing to workqueue") Reported-by: Fabio Estevam <[email protected]> Tested-by: Fabio Estevam <[email protected]> Cc: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Jiri Slaby <[email protected]>
1 parent 6327341 commit 60fe3f6

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

net/ipv6/icmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
516516
np->tclass, NULL, &fl6, (struct rt6_info *)dst,
517517
MSG_DONTWAIT, np->dontfrag);
518518
if (err) {
519-
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
519+
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
520520
ip6_flush_pending_frames(sk);
521521
} else {
522522
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,

net/ipv6/ip6_output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,8 +1535,8 @@ int ip6_push_pending_frames(struct sock *sk)
15351535
if (proto == IPPROTO_ICMPV6) {
15361536
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
15371537

1538-
ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type);
1539-
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
1538+
ICMP6MSGOUT_INC_STATS(net, idev, icmp6_hdr(skb)->icmp6_type);
1539+
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
15401540
}
15411541

15421542
err = ip6_local_out(skb);

net/ipv6/mcast.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
16201620
dst_output);
16211621
out:
16221622
if (!err) {
1623-
ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);
1624-
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
1625-
IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
1626-
} else
1627-
IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
1623+
ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
1624+
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
1625+
IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
1626+
} else {
1627+
IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
1628+
}
16281629

16291630
rcu_read_unlock();
16301631
return;

net/ipv6/ping.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
182182
MSG_DONTWAIT, np->dontfrag);
183183

184184
if (err) {
185-
ICMP6_INC_STATS_BH(sock_net(sk), rt->rt6i_idev,
186-
ICMP6_MIB_OUTERRORS);
185+
ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
186+
ICMP6_MIB_OUTERRORS);
187187
ip6_flush_pending_frames(sk);
188188
} else {
189189
err = icmpv6_push_pending_frames(sk, &fl6,

0 commit comments

Comments
 (0)