android_kernel_sony_sdm845/net
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Eric Dumazet 29e13f6b38 tcp: fix tcp_mtup_probe_success vs wrong snd_cwnd
commit 11825765291a93d8e7f44230da67b9f607c777bf upstream.

syzbot got a new report [1] finally pointing to a very old bug,
added in initial support for MTU probing.

tcp_mtu_probe() has checks about starting an MTU probe if
tcp_snd_cwnd(tp) >= 11.

But nothing prevents tcp_snd_cwnd(tp) to be reduced later
and before the MTU probe succeeds.

This bug would lead to potential zero-divides.

Debugging added in commit 40570375356c ("tcp: add accessors
to read/set tp->snd_cwnd") has paid off :)

While we are at it, address potential overflows in this code.

[1]
WARNING: CPU: 1 PID: 14132 at include/net/tcp.h:1219 tcp_mtup_probe_success+0x366/0x570 net/ipv4/tcp_input.c:2712
Modules linked in:
CPU: 1 PID: 14132 Comm: syz-executor.2 Not tainted 5.18.0-syzkaller-07857-gbabf0bb978e3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:tcp_snd_cwnd_set include/net/tcp.h:1219 [inline]
RIP: 0010:tcp_mtup_probe_success+0x366/0x570 net/ipv4/tcp_input.c:2712
Code: 74 08 48 89 ef e8 da 80 17 f9 48 8b 45 00 65 48 ff 80 80 03 00 00 48 83 c4 30 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 aa b0 c5 f8 <0f> 0b e9 16 fe ff ff 48 8b 4c 24 08 80 e1 07 38 c1 0f 8c c7 fc ff
RSP: 0018:ffffc900079e70f8 EFLAGS: 00010287
RAX: ffffffff88c0f7f6 RBX: ffff8880756e7a80 RCX: 0000000000040000
RDX: ffffc9000c6c4000 RSI: 0000000000031f9e RDI: 0000000000031f9f
RBP: 0000000000000000 R08: ffffffff88c0f606 R09: ffffc900079e7520
R10: ffffed101011226d R11: 1ffff1101011226c R12: 1ffff1100eadcf50
R13: ffff8880756e72c0 R14: 1ffff1100eadcf89 R15: dffffc0000000000
FS:  00007f643236e700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1ab3f1e2a0 CR3: 0000000064fe7000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 tcp_clean_rtx_queue+0x223a/0x2da0 net/ipv4/tcp_input.c:3356
 tcp_ack+0x1962/0x3c90 net/ipv4/tcp_input.c:3861
 tcp_rcv_established+0x7c8/0x1ac0 net/ipv4/tcp_input.c:5973
 tcp_v6_do_rcv+0x57b/0x1210 net/ipv6/tcp_ipv6.c:1476
 sk_backlog_rcv include/net/sock.h:1061 [inline]
 __release_sock+0x1d8/0x4c0 net/core/sock.c:2849
 release_sock+0x5d/0x1c0 net/core/sock.c:3404
 sk_stream_wait_memory+0x700/0xdc0 net/core/stream.c:145
 tcp_sendmsg_locked+0x111d/0x3fc0 net/ipv4/tcp.c:1410
 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1448
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg net/socket.c:734 [inline]
 __sys_sendto+0x439/0x5c0 net/socket.c:2119
 __do_sys_sendto net/socket.c:2131 [inline]
 __se_sys_sendto net/socket.c:2127 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2127
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f6431289109
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f643236e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f643139c100 RCX: 00007f6431289109
RDX: 00000000d0d0c2ac RSI: 0000000020000080 RDI: 000000000000000a
RBP: 00007f64312e308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff372533af R14: 00007f643236e300 R15: 0000000000022000

Fixes: 5d424d5a67 ("[TCP]: MTU probing")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-14 16:52:42 +02:00
..
6lowpan 6lowpan: Off by one handling ->nexthdr 2020-01-29 10:24:22 +01:00
9p 9p/trans_virtio: Remove sysfs file on probe failure 2021-09-26 13:36:18 +02:00
802 net/802/garp: fix memleak in garp_request_join() 2021-08-04 11:58:02 +02:00
8021q vlan: fix memory leak in vlan_dev_set_egress_priority 2020-01-12 11:24:27 +01:00
appletalk appletalk: Fix skb allocation size in loopback case 2021-04-07 12:05:39 +02:00
atm atm: fix a memory leak of vcc->user_back 2020-10-01 20:40:12 +02:00
ax25 ax25: Fix NULL pointer dereference in ax25_kill_by_device 2022-03-16 12:49:00 +01:00
batman-adv batman-adv: Don't expect inter-netns unique iflink indices 2022-03-16 12:49:01 +01:00
bluetooth Bluetooth: fix dangling sco_conn and use-after-free in sco_sock_timeout 2022-06-14 16:52:32 +02:00
bridge netfilter: bridge: add support for pppoe filtering 2022-01-27 08:47:33 +01:00
caif net-caif: avoid user-triggerable WARN_ON(1) 2021-09-22 11:43:09 +02:00
can can: bcm: fix UAF of bcm op 2022-02-08 18:15:26 +01:00
ceph libceph: clear con->out_msg on Policy::stateful_server faults 2020-11-10 10:23:59 +01:00
core bpf: Enlarge offset check value to INT_MAX in bpf_skb_{load,store}_bytes 2022-06-06 08:19:46 +02:00
dcb net: dcb: disable softirqs in dcbnl_flush_dev() 2022-03-08 19:00:59 +01:00
dccp dccp: don't duplicate ccid when cloning dccp sock 2021-09-22 11:43:09 +02:00
decnet net: decnet: Fix sleeping inside in af_decnet 2021-07-28 09:14:27 +02:00
dns_resolver KEYS: DNS: fix parsing multiple options 2018-07-22 14:27:39 +02:00
dsa net: dsa: tag_brcm: Fix skb->fwd_offload_mark location 2020-04-13 10:32:53 +02:00
ethernet net: add annotations on hh->hh_len lockless accesses 2020-01-12 11:24:19 +01:00
hsr hsr: use netdev_err() instead of WARN_ONCE() 2021-05-22 10:40:20 +02:00
ieee802154 net: ieee802154: Return meaningful error codes from the netlink helpers 2022-02-08 18:15:29 +01:00
ipv4 tcp: fix tcp_mtup_probe_success vs wrong snd_cwnd 2022-06-14 16:52:42 +02:00
ipv6 ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL 2022-06-14 16:52:29 +02:00
ipx ipx: call ipxitf_put() in ioctl error path 2017-05-25 15:44:41 +02:00
irda irda: Only insert new objects into the global database via setsockopt 2018-09-15 09:43:01 +02:00
iucv net/af_iucv: set correct sk_protocol for child sockets 2020-12-11 13:37:56 +01:00
kcm kcm: switch order of device registration to fix a crash 2019-04-17 08:36:44 +02:00
key Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" 2022-06-14 16:52:40 +02:00
l2tp net/l2tp: Fix reference count leak in l2tp_udp_recv_core 2021-09-22 11:43:09 +02:00
l3mdev
lapb net: lapb: Copy the skb before sending a packet 2021-02-10 09:09:25 +01:00
llc llc: only change llc->dev when bind() succeeds 2022-03-28 08:06:06 +02:00
mac80211 mac80211: upgrade passive scan to active scan on DFS channels after beacon rx 2022-06-14 16:52:35 +02:00
mac802154 net: mac802154: Fix general protection fault 2021-04-16 11:59:10 +02:00
mpls net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0 2021-03-17 16:10:13 +01:00
ncsi net/ncsi: Use real net-device for response handler 2021-01-12 19:49:01 +01:00
netfilter netfilter: nf_tables: disallow non-stateful expression in sets earlier 2022-06-14 16:52:36 +02:00
netlabel cipso,calipso: resolve a number of problems with the DOI refcounts 2022-01-27 08:47:42 +01:00
netlink netlink: do not reset transport header in netlink_recvmsg() 2022-05-18 09:15:43 +02:00
netrom netrom: Decrease sock refcount when sock timers expire 2021-07-28 09:14:27 +02:00
nfc NFC: NULL out the dev->rfkill to prevent UAF 2022-06-14 16:52:31 +02:00
openvswitch openvswitch: fix OOB access in reserve_sfa_size() 2022-04-27 13:14:11 +02:00
packet net/packet: fix packet_sock xmit return value checking 2022-04-27 13:14:10 +02:00
phonet phonet: refcount leak in pep_sock_accep 2022-01-11 13:38:12 +01:00
qrtr net: qrtr: fix a kernel-infoleak in qrtr_recvmsg() 2021-03-30 14:41:42 +02:00
rds net/rds: correct socket tunable error in rds_tcp_tune() 2021-12-08 08:45:06 +01:00
rfkill rfkill: Fix incorrect check to avoid NULL pointer dereference 2020-01-12 11:24:23 +01:00
rose rose: Fix Null pointer dereference in rose_send_frame() 2020-12-11 13:37:56 +01:00
rxrpc rxrpc: Don't try to resend the request if we're receiving the reply 2022-06-14 16:52:33 +02:00
sched net: sched: prevent UAF on tc_ctl_tfilter when temporarily dropping rtnl_lock 2022-05-12 12:14:58 +02:00
sctp sctp: read sk->sk_bound_dev_if once in sctp_rcv() 2022-06-14 16:52:32 +02:00
strparser strparser: Fix incorrect strp->need_bytes value. 2018-04-29 11:32:02 +02:00
sunrpc SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer() 2022-06-14 16:52:39 +02:00
switchdev switchdev: Execute bridge ndos only for bridge ports 2016-10-19 10:58:04 -04:00
tipc tipc: rate limit warning for received illegal binding update 2022-02-16 12:43:54 +01:00
unix af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress 2022-01-27 08:47:41 +01:00
vmw_vsock vsock: remove vsock from connected table when connect is interrupted by a signal 2022-02-23 11:56:40 +01:00
wimax
wireless nl80211: Update bss channel on channel switch for P2P_CLIENT 2022-03-23 09:00:33 +01:00
x25 net/x25: Fix null-ptr-deref caused by x25_disconnect 2022-04-20 09:06:38 +02:00
xfrm xfrm: policy: match with both mark and mask on user interfaces 2022-04-20 09:06:44 +02:00
compat.c net: Return the correct errno code 2021-06-30 08:49:12 -04:00
Kconfig
Makefile net: split out functions related to registering inflight socket files 2021-08-04 11:58:01 +02:00
socket.c net: Set fput_needed iff FDPUT_FPUT is set 2020-08-21 11:02:04 +02:00
sysctl_net.c