Skip to content

Commit f1d8cba

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
inet: fix possible seqlock deadlocks
In commit c9e9042 ("ipv4: fix possible seqlock deadlock") I left another places where IP_INC_STATS_BH() were improperly used. udp_sendmsg(), ping_v4_sendmsg() and tcp_v4_connect() are called from process context, not from softirq context. This was detected by lockdep seqlock support. Reported-by: jongman heo <[email protected]> Fixes: 584bdf8 ("[IPV4]: Fix "ipOutNoRoutes" counter error for TCP and UDP") Fixes: c319b4d ("net: ipv4: add IPPROTO_ICMP socket kind") Signed-off-by: Eric Dumazet <[email protected]> Cc: Hannes Frederic Sowa <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f5e0d34 commit f1d8cba

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: net/ipv4/ping.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
772772
err = PTR_ERR(rt);
773773
rt = NULL;
774774
if (err == -ENETUNREACH)
775-
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
775+
IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
776776
goto out;
777777
}
778778

Diff for: net/ipv4/tcp_ipv4.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
177177
if (IS_ERR(rt)) {
178178
err = PTR_ERR(rt);
179179
if (err == -ENETUNREACH)
180-
IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
180+
IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
181181
return err;
182182
}
183183

Diff for: net/ipv4/udp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
999999
err = PTR_ERR(rt);
10001000
rt = NULL;
10011001
if (err == -ENETUNREACH)
1002-
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
1002+
IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
10031003
goto out;
10041004
}
10051005

0 commit comments

Comments
 (0)