https://github.com/torvalds/linux
Revision 2c7269b231194aae23fb90ab65842573a91acbc9 authored by Sabrina Dubroca on 10 June 2020, 10:19:43 UTC, committed by Alexei Starovoitov on 12 June 2020, 22:10:12 UTC
If the peer is closed, we will never get more data, so
tcp_bpf_wait_data will get stuck forever. In case we passed
MSG_DONTWAIT to recv(), we get EAGAIN but we should actually get
0.

>From man 2 recv:

    RETURN VALUE

    When a stream socket peer has performed an orderly shutdown, the
    return value will be 0 (the traditional "end-of-file" return).

This patch makes tcp_bpf_wait_data always return 1 when the peer
socket has been shutdown. Either we have data available, and it would
have returned 1 anyway, or there isn't, in which case we'll call
tcp_recvmsg which does the right thing in this situation.

Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/26038a28c21fea5d04d4bd4744c5686d3f2e5504.1591784177.git.sd@queasysnail.net
1 parent 2c4779e
History
Tip revision: 2c7269b231194aae23fb90ab65842573a91acbc9 authored by Sabrina Dubroca on 10 June 2020, 10:19:43 UTC
bpf: tcp: Recv() should return 0 when the peer socket is closed
Tip revision: 2c7269b
File Mode Size
Kconfig -rw-r--r-- 4.0 KB
Makefile -rw-r--r-- 1.3 KB
bat_algo.c -rw-r--r-- 5.6 KB
bat_algo.h -rw-r--r-- 755 bytes
bat_iv_ogm.c -rw-r--r-- 79.6 KB
bat_iv_ogm.h -rw-r--r-- 303 bytes
bat_v.c -rw-r--r-- 29.9 KB
bat_v.h -rw-r--r-- 827 bytes
bat_v_elp.c -rw-r--r-- 16.5 KB
bat_v_elp.h -rw-r--r-- 832 bytes
bat_v_ogm.c -rw-r--r-- 32.6 KB
bat_v_ogm.h -rw-r--r-- 925 bytes
bitarray.c -rw-r--r-- 2.6 KB
bitarray.h -rw-r--r-- 1.5 KB
bridge_loop_avoidance.c -rw-r--r-- 69.7 KB
bridge_loop_avoidance.h -rw-r--r-- 3.9 KB
debugfs.c -rw-r--r-- 12.3 KB
debugfs.h -rw-r--r-- 1.6 KB
distributed-arp-table.c -rw-r--r-- 52.1 KB
distributed-arp-table.h -rw-r--r-- 4.8 KB
fragmentation.c -rw-r--r-- 15.6 KB
fragmentation.h -rw-r--r-- 1.3 KB
gateway_client.c -rw-r--r-- 22.1 KB
gateway_client.h -rw-r--r-- 1.7 KB
gateway_common.c -rw-r--r-- 7.3 KB
gateway_common.h -rw-r--r-- 1.0 KB
hard-interface.c -rw-r--r-- 29.4 KB
hard-interface.h -rw-r--r-- 3.9 KB
hash.c -rw-r--r-- 1.7 KB
hash.h -rw-r--r-- 3.9 KB
icmp_socket.c -rw-r--r-- 9.9 KB
icmp_socket.h -rw-r--r-- 745 bytes
log.c -rw-r--r-- 5.3 KB
log.h -rw-r--r-- 4.0 KB
main.c -rw-r--r-- 20.3 KB
main.h -rw-r--r-- 12.3 KB
multicast.c -rw-r--r-- 72.0 KB
multicast.h -rw-r--r-- 2.5 KB
netlink.c -rw-r--r-- 40.7 KB
netlink.h -rw-r--r-- 955 bytes
network-coding.c -rw-r--r-- 57.8 KB
network-coding.h -rw-r--r-- 3.1 KB
originator.c -rw-r--r-- 41.7 KB
originator.h -rw-r--r-- 3.2 KB
routing.c -rw-r--r-- 36.6 KB
routing.h -rw-r--r-- 1.7 KB
send.c -rw-r--r-- 29.6 KB
send.h -rw-r--r-- 4.2 KB
soft-interface.c -rw-r--r-- 32.1 KB
soft-interface.h -rw-r--r-- 1.1 KB
sysfs.c -rw-r--r-- 35.3 KB
sysfs.h -rw-r--r-- 2.3 KB
tp_meter.c -rw-r--r-- 42.3 KB
tp_meter.h -rw-r--r-- 629 bytes
trace.c -rw-r--r-- 164 bytes
trace.h -rw-r--r-- 1.6 KB
translation-table.c -rw-r--r-- 132.8 KB
translation-table.h -rw-r--r-- 2.6 KB
tvlv.c -rw-r--r-- 18.7 KB
tvlv.h -rw-r--r-- 1.7 KB
types.h -rw-r--r-- 62.5 KB

back to top