Skip to content

Commit 580f98c

Browse files
edumazetkuba-moo
authored andcommitted
tcp: tcp_check_req() can be called from process context
This is a follow up of commit 0a375c8 ("tcp: tcp_rtx_synack() can be called from process context"). Frederick Lawler reported another "__this_cpu_add() in preemptible" warning caused by the same reason. In my former patch I took care of tcp_rtx_synack() but forgot that tcp_check_req() also contained some SNMP updates. Note that some parts of tcp_check_req() always run in BH context, I added a comment to clarify this. Fixes: 8336886 ("tcp: TCP Fast Open Server - support TFO listeners") Link: https://lore.kernel.org/netdev/[email protected]/T/ Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Frederick Lawler <[email protected]> Tested-by: Frederick Lawler <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 972074e commit 580f98c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/ipv4/tcp_minisocks.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ EXPORT_SYMBOL(tcp_create_openreq_child);
597597
* validation and inside tcp_v4_reqsk_send_ack(). Can we do better?
598598
*
599599
* We don't need to initialize tmp_opt.sack_ok as we don't use the results
600+
*
601+
* Note: If @fastopen is true, this can be called from process context.
602+
* Otherwise, this is from BH context.
600603
*/
601604

602605
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
@@ -748,7 +751,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
748751
&tcp_rsk(req)->last_oow_ack_time))
749752
req->rsk_ops->send_ack(sk, skb, req);
750753
if (paws_reject)
751-
__NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
754+
NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
752755
return NULL;
753756
}
754757

@@ -767,7 +770,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
767770
* "fourth, check the SYN bit"
768771
*/
769772
if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) {
770-
__TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
773+
TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
771774
goto embryonic_reset;
772775
}
773776

0 commit comments

Comments
 (0)