diff options
author | Eric Dumazet <edumazet@google.com> | 2016-05-06 12:46:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-06 16:02:43 -0400 |
commit | 47dcc20a39d06585bf3cb9fb381f0e81c20002c3 (patch) | |
tree | 43e62bc10c7584ed69b6ef78bfb61fb48e5470c0 /net/ipv4/tcp_ipv4.c | |
parent | 4b307a8edb6b6f59b6f2bfe9f36fcec6e43ec911 (diff) |
ipv4: tcp: ip_send_unicast_reply() is not BH safe
I forgot that ip_send_unicast_reply() is not BH safe (yet).
Disabling preemption before calling it was not a good move.
Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andres Lagar-Cavilla <andreslc@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a7ab9472d645..8219d0d8dc83 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -692,7 +692,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
692 | offsetof(struct inet_timewait_sock, tw_bound_dev_if)); | 692 | offsetof(struct inet_timewait_sock, tw_bound_dev_if)); |
693 | 693 | ||
694 | arg.tos = ip_hdr(skb)->tos; | 694 | arg.tos = ip_hdr(skb)->tos; |
695 | preempt_disable(); | 695 | local_bh_disable(); |
696 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), | 696 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), |
697 | skb, &TCP_SKB_CB(skb)->header.h4.opt, | 697 | skb, &TCP_SKB_CB(skb)->header.h4.opt, |
698 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 698 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
@@ -700,7 +700,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
700 | 700 | ||
701 | __TCP_INC_STATS(net, TCP_MIB_OUTSEGS); | 701 | __TCP_INC_STATS(net, TCP_MIB_OUTSEGS); |
702 | __TCP_INC_STATS(net, TCP_MIB_OUTRSTS); | 702 | __TCP_INC_STATS(net, TCP_MIB_OUTRSTS); |
703 | preempt_enable(); | 703 | local_bh_enable(); |
704 | 704 | ||
705 | #ifdef CONFIG_TCP_MD5SIG | 705 | #ifdef CONFIG_TCP_MD5SIG |
706 | out: | 706 | out: |
@@ -776,14 +776,14 @@ static void tcp_v4_send_ack(struct net *net, | |||
776 | if (oif) | 776 | if (oif) |
777 | arg.bound_dev_if = oif; | 777 | arg.bound_dev_if = oif; |
778 | arg.tos = tos; | 778 | arg.tos = tos; |
779 | preempt_disable(); | 779 | local_bh_disable(); |
780 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), | 780 | ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), |
781 | skb, &TCP_SKB_CB(skb)->header.h4.opt, | 781 | skb, &TCP_SKB_CB(skb)->header.h4.opt, |
782 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, | 782 | ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
783 | &arg, arg.iov[0].iov_len); | 783 | &arg, arg.iov[0].iov_len); |
784 | 784 | ||
785 | __TCP_INC_STATS(net, TCP_MIB_OUTSEGS); | 785 | __TCP_INC_STATS(net, TCP_MIB_OUTSEGS); |
786 | preempt_enable(); | 786 | local_bh_enable(); |
787 | } | 787 | } |
788 | 788 | ||
789 | static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) | 789 | static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) |