Dong Chenchen
510d45207a
net: Remove acked SYN flag from packet in the transmit queue correctly
[ Upstream commit f99cd56230f56c8b6b33713c5be4da5d6766be1f ]
syzkaller report:
kernel BUG at net/core/skbuff.c:3452!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc4-00009-gbee0e7762ad2-dirty #135
RIP: 0010:skb_copy_and_csum_bits (net/core/skbuff.c:3452)
Call Trace:
icmp_glue_bits (net/ipv4/icmp.c:357)
__ip_append_data.isra.0 (net/ipv4/ip_output.c:1165)
ip_append_data (net/ipv4/ip_output.c:1362 net/ipv4/ip_output.c:1341)
icmp_push_reply (net/ipv4/icmp.c:370)
__icmp_send (./include/net/route.h:252 net/ipv4/icmp.c:772)
ip_fragment.constprop.0 (./include/linux/skbuff.h:1234 net/ipv4/ip_output.c:592 net/ipv4/ip_output.c:577)
__ip_finish_output (net/ipv4/ip_output.c:311 net/ipv4/ip_output.c:295)
ip_output (net/ipv4/ip_output.c:427)
__ip_queue_xmit (net/ipv4/ip_output.c:535)
__tcp_transmit_skb (net/ipv4/tcp_output.c:1462)
__tcp_retransmit_skb (net/ipv4/tcp_output.c:3387)
tcp_retransmit_skb (net/ipv4/tcp_output.c:3404)
tcp_retransmit_timer (net/ipv4/tcp_timer.c:604)
tcp_write_timer (./include/linux/spinlock.h:391 net/ipv4/tcp_timer.c:716)
The panic issue was trigered by tcp simultaneous initiation.
The initiation process is as follows:
TCP A TCP B
1. CLOSED CLOSED
2. SYN-SENT --> <SEQ=100><CTL=SYN> ...
3. SYN-RECEIVED <-- <SEQ=300><CTL=SYN> <-- SYN-SENT
4. ... <SEQ=100><CTL=SYN> --> SYN-RECEIVED
5. SYN-RECEIVED --> <SEQ=100><ACK=301><CTL=SYN,ACK> ...
// TCP B: not send challenge ack for ack limit or packet loss
// TCP A: close
tcp_close
tcp_send_fin
if (!tskb && tcp_under_memory_pressure(sk))
tskb = skb_rb_last(&sk->tcp_rtx_queue); //pick SYN_ACK packet
TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN; // set FIN flag
6. FIN_WAIT_1 --> <SEQ=100><ACK=301><END_SEQ=102><CTL=SYN,FIN,ACK> ...
// TCP B: send challenge ack to SYN_FIN_ACK
7. ... <SEQ=301><ACK=101><CTL=ACK> <-- SYN-RECEIVED //challenge ack
// TCP A: <SND.UNA=101>
8. FIN_WAIT_1 --> <SEQ=101><ACK=301><END_SEQ=102><CTL=SYN,FIN,ACK> ... // retransmit panic
__tcp_retransmit_skb //skb->len=0
tcp_trim_head
len = tp->snd_una - TCP_SKB_CB(skb)->seq // len=101-100
__pskb_trim_head
skb->data_len -= len // skb->len=-1, wrap around
... ...
ip_fragment
icmp_glue_bits //BUG_ON
If we use tcp_trim_head() to remove acked SYN from packet that contains data
or other flags, skb->len will be incorrectly decremented. We can remove SYN
flag that has been acked from rtx_queue earlier than tcp_trim_head(), which
can fix the problem mentioned above.
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Co-developed-by: Eric Dumazet <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: Dong Chenchen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
|
2023-12-20 15:41:16 +01:00 |
| .. |
|
6lowpan
|
|
|
|
9p
|
9p: virtio: make sure 'offs' is initialized in zc_request
|
2023-09-23 10:59:37 +02:00 |
|
802
|
|
|
|
8021q
|
vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit()
|
2023-05-30 12:44:06 +01:00 |
|
appletalk
|
|
|
|
atm
|
atm: Fix Use-After-Free in do_vcc_ioctl
|
2023-12-20 15:41:15 +01:00 |
|
ax25
|
|
|
|
batman-adv
|
batman-adv: Hold rtnl lock during MTU update via netlink
|
2023-08-30 16:27:25 +02:00 |
|
bluetooth
|
Bluetooth: Fix double free in hci_conn_cleanup
|
2023-11-28 16:50:14 +00:00 |
|
bpf
|
|
|
|
bpfilter
|
|
|
|
bridge
|
netfilter: nf_conntrack_bridge: initialize err to 0
|
2023-11-28 16:50:17 +00:00 |
|
caif
|
net: caif: Fix use-after-free in cfusbl_device_notify()
|
2023-03-17 08:32:51 +01:00 |
|
can
|
can: bcm: Fix UAF in bcm_proc_show()
|
2023-07-27 08:37:40 +02:00 |
|
ceph
|
libceph: use kernel_connect()
|
2023-10-25 11:53:19 +02:00 |
|
core
|
drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
|
2023-12-13 18:18:17 +01:00 |
|
dcb
|
net: dcb: choose correct policy to parse DCB_ATTR_BCN
|
2023-08-11 11:53:57 +02:00 |
|
dccp
|
dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
|
2023-11-20 10:30:15 +01:00 |
|
decnet
|
Remove DECnet support from kernel
|
2023-06-21 15:44:10 +02:00 |
|
dns_resolver
|
|
|
|
dsa
|
net: dsa: tag_sja1105: fix MAC DA patching from meta frames
|
2023-07-27 08:37:24 +02:00 |
|
ethernet
|
|
|
|
hsr
|
|
|
|
ieee802154
|
|
|
|
ife
|
|
|
|
ipv4
|
net: Remove acked SYN flag from packet in the transmit queue correctly
|
2023-12-20 15:41:16 +01:00 |
|
ipv6
|
net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
|
2023-12-20 15:41:13 +01:00 |
|
iucv
|
treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD()
|
2023-04-20 12:07:32 +02:00 |
|
kcm
|
kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
|
2023-09-23 11:00:02 +02:00 |
|
key
|
net: af_key: fix sadb_x_filter validation
|
2023-08-30 16:27:16 +02:00 |
|
l2tp
|
ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data()
|
2023-10-10 21:46:44 +02:00 |
|
l3mdev
|
|
|
|
lapb
|
|
|
|
llc
|
llc: verify mac len before reading mac header
|
2023-11-20 10:30:15 +01:00 |
|
mac80211
|
wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
|
2023-11-28 16:50:13 +00:00 |
|
mac802154
|
|
|
|
mpls
|
net: mpls: fix stale pointer if allocation fails during device rename
|
2023-02-22 12:50:41 +01:00 |
|
ncsi
|
Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
|
2023-11-28 16:50:21 +00:00 |
|
netfilter
|
netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
|
2023-12-13 18:18:12 +01:00 |
|
netlabel
|
netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
|
2023-09-23 10:59:39 +02:00 |
|
netlink
|
drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
|
2023-12-13 18:18:17 +01:00 |
|
netrom
|
netrom: Deny concurrent connect().
|
2023-09-23 10:59:43 +02:00 |
|
nfc
|
nfc: nci: fix possible NULL pointer dereference in send_acknowledge()
|
2023-10-25 11:53:20 +02:00 |
|
nsh
|
net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment()
|
2023-05-30 12:44:05 +01:00 |
|
openvswitch
|
|
|
|
packet
|
packet: Move reference count in packet_sock to atomic_long_t
|
2023-12-13 18:18:14 +01:00 |
|
phonet
|
|
|
|
psample
|
psample: Require 'CAP_NET_ADMIN' when joining "packets" group
|
2023-12-13 18:18:17 +01:00 |
|
qrtr
|
|
|
|
rds
|
net: prevent address rewrite in kernel_bind()
|
2023-10-25 11:53:18 +02:00 |
|
rfkill
|
net: rfkill: gpio: prevent value glitch during probe
|
2023-10-25 11:53:21 +02:00 |
|
rose
|
net/rose: Fix Use-After-Free in rose_ioctl
|
2023-12-20 15:41:16 +01:00 |
|
rxrpc
|
rxrpc: Fix hard call timeout units
|
2023-05-17 11:35:59 +02:00 |
|
sched
|
net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
|
2023-10-25 11:53:21 +02:00 |
|
sctp
|
sctp: update hb timer immediately after users change hb_interval
|
2023-10-10 21:46:45 +02:00 |
|
smc
|
net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
|
2023-11-20 10:30:16 +01:00 |
|
strparser
|
|
|
|
sunrpc
|
SUNRPC: Mark the cred for revalidation if the server rejects it
|
2023-10-10 21:46:35 +02:00 |
|
switchdev
|
|
|
|
tipc
|
tipc: Fix kernel-infoleak due to uninitialized TLV value
|
2023-11-28 16:50:16 +00:00 |
|
tls
|
net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict()
|
2023-09-23 11:00:02 +02:00 |
|
unix
|
af_unix: Fix data-race around unix_tot_inflight.
|
2023-09-23 10:59:58 +02:00 |
|
vmw_vsock
|
vsock: avoid to close connected socket after the timeout
|
2023-05-30 12:44:05 +01:00 |
|
wimax
|
|
|
|
wireless
|
wifi: cfg80211: avoid leaking stack data into trace
|
2023-10-25 11:53:23 +02:00 |
|
x25
|
net/x25: Fix to not accept on connected socket
|
2023-02-22 12:50:26 +01:00 |
|
xdp
|
xsk: Honor SO_BINDTODEVICE on bind
|
2023-07-27 08:37:23 +02:00 |
|
xfrm
|
xfrm: interface: use DEV_STATS_INC()
|
2023-10-25 11:53:21 +02:00 |
|
compat.c
|
|
|
|
Kconfig
|
Remove DECnet support from kernel
|
2023-06-21 15:44:10 +02:00 |
|
Makefile
|
Remove DECnet support from kernel
|
2023-06-21 15:44:10 +02:00 |
|
socket.c
|
net: prevent address rewrite in kernel_bind()
|
2023-10-25 11:53:18 +02:00 |
|
sysctl_net.c
|
|
|