WSL2-Linux-Kernel/net
Xin Long 2ea600b598 sctp: clear out_curr if all frag chunks of current msg are pruned
[ Upstream commit 2f201ae14a ]

A crash was reported by Zhen Chen:

  list_del corruption, ffffa035ddf01c18->next is NULL
  WARNING: CPU: 1 PID: 250682 at lib/list_debug.c:49 __list_del_entry_valid+0x59/0xe0
  RIP: 0010:__list_del_entry_valid+0x59/0xe0
  Call Trace:
   sctp_sched_dequeue_common+0x17/0x70 [sctp]
   sctp_sched_fcfs_dequeue+0x37/0x50 [sctp]
   sctp_outq_flush_data+0x85/0x360 [sctp]
   sctp_outq_uncork+0x77/0xa0 [sctp]
   sctp_cmd_interpreter.constprop.0+0x164/0x1450 [sctp]
   sctp_side_effects+0x37/0xe0 [sctp]
   sctp_do_sm+0xd0/0x230 [sctp]
   sctp_primitive_SEND+0x2f/0x40 [sctp]
   sctp_sendmsg_to_asoc+0x3fa/0x5c0 [sctp]
   sctp_sendmsg+0x3d5/0x440 [sctp]
   sock_sendmsg+0x5b/0x70

and in sctp_sched_fcfs_dequeue() it dequeued a chunk from stream
out_curr outq while this outq was empty.

Normally stream->out_curr must be set to NULL once all frag chunks of
current msg are dequeued, as we can see in sctp_sched_dequeue_done().
However, in sctp_prsctp_prune_unsent() as it is not a proper dequeue,
sctp_sched_dequeue_done() is not called to do this.

This patch is to fix it by simply setting out_curr to NULL when the
last frag chunk of current msg is dequeued from out_curr stream in
sctp_prsctp_prune_unsent().

Fixes: 5bbbbe32a4 ("sctp: introduce stream scheduler foundations")
Reported-by: Zhen Chen <chenzhen126@huawei.com>
Tested-by: Caowangbao <caowangbao@huawei.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-02 17:40:59 +01:00
..
6lowpan 6lowpan: iphc: Fix an off-by-one check of array index 2021-07-22 16:19:03 +02:00
9p net/9p: use a dedicated spinlock for trans_fd 2022-11-26 09:24:51 +01:00
802 net: 802: remove dead leftover after ipx driver removal 2021-08-13 16:30:35 -07:00
8021q net: use eth_hw_addr_set() instead of ether_addr_copy() 2022-08-31 17:16:37 +02:00
appletalk net: socket: rework compat_ifreq_ioctl() 2021-07-23 14:20:25 +01:00
atm net/atm: fix proc_mpc_write incorrect return value 2022-10-29 10:12:55 +02:00
ax25 net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg 2022-06-22 14:22:01 +02:00
batman-adv batman-adv: Use netif_rx_any_context() any. 2022-07-29 17:25:07 +02:00
bluetooth Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm 2022-11-26 09:24:32 +01:00
bpf bpf, test_run: Fix alignment problem in bpf_prog_test_run_skb() 2022-11-26 09:24:35 +01:00
bpfilter bpfilter: Specify the log level for the kmsg message 2021-06-25 13:13:50 +02:00
bridge bridge: switchdev: Fix memory leaks when changing VLAN protocol 2022-11-26 09:24:40 +01:00
caif net: caif: fix double disconnect client in chnl_net_open() 2022-11-26 09:24:39 +01:00
can can: j1939: j1939_send_one(): fix missing CAN header initialization 2022-11-16 09:58:28 +01:00
ceph libceph: fix potential use-after-free on linger ping and resends 2022-05-25 09:57:28 +02:00
core net: gso: fix panic on frag_list with mixed head alloc types 2022-11-16 09:58:16 +01:00
dcb net: dcb: disable softirqs in dcbnl_flush_dev() 2022-03-08 19:12:52 +01:00
dccp dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock 2022-08-17 14:23:37 +02:00
decnet net: Fix data-races around sysctl_[rw]mem(_offset)?. 2022-08-03 12:03:51 +02:00
dns_resolver
dsa net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims 2022-11-26 09:24:40 +01:00
ethernet move netdev_boot_setup into Space.c 2021-08-03 13:05:26 +01:00
ethtool ethtool: eeprom: fix null-deref on genl_info in dump 2022-11-03 23:59:14 +09:00
hsr net: hsr: avoid possible NULL deref in skb_clone() 2022-10-29 10:12:56 +02:00
ieee802154 net: ieee802154: fix error return code in dgram_bind() 2022-11-03 23:59:14 +09:00
ife
ipv4 tcp: cdg: allow tcp_cdg_release() to be called multiple times 2022-11-26 09:24:50 +01:00
ipv6 ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network 2022-11-16 09:58:18 +01:00
iucv net/iucv: Replace deprecated CPU-hotplug functions. 2021-08-09 10:13:32 +01:00
kcm kcm: close race conditions on sk_receive_queue 2022-11-26 09:24:50 +01:00
key af_key: Do not call xfrm_probe_algs in parallel 2022-08-31 17:16:36 +02:00
l2tp ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg 2022-06-22 14:21:58 +02:00
l3mdev l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using netdev_master_upper_dev_get_rcu 2022-04-27 14:38:53 +02:00
lapb net: lapb: Use list_for_each_entry() to simplify code in lapb_iface.c 2021-06-08 16:31:25 -07:00
llc llc: only change llc->dev when bind() succeeds 2022-03-28 09:58:46 +02:00
mac80211 wifi: mac80211: Set TWT Information Frame Disabled bit as 1 2022-11-16 09:58:14 +01:00
mac802154 mac802154: Fix LQI recording 2022-11-03 23:59:12 +09:00
mctp mctp: Fix an error handling path in mctp_init() 2022-11-16 09:58:22 +01:00
mpls net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-09-08 12:28:07 +02:00
mptcp mptcp: Fix crash due to tcp_tsorted_anchor was initialized before release skb 2022-08-31 17:16:50 +02:00
ncsi net/ncsi: check for error return from call to nla_put_u32 2022-01-05 12:42:37 +01:00
netfilter netfilter: Cleanup nft_net->module_list from nf_tables_exit_net() 2022-11-16 09:58:20 +01:00
netlabel netlabel: fix out-of-bounds memory accesses 2022-04-13 20:59:10 +02:00
netlink net: genl: fix error path memory leak in policy dumping 2022-08-25 11:40:25 +02:00
netrom netrom: fix api breakage in nr_setsockopt() 2022-01-27 11:04:00 +01:00
nfc NFC: NULL out the dev->rfkill to prevent UAF 2022-06-09 10:22:46 +02:00
nsh
openvswitch openvswitch: switch from WARN to pr_warn 2022-11-03 23:59:18 +09:00
packet net/af_packet: check len when min_header_len equals to 0 2022-09-05 10:30:12 +02:00
phonet phonet: refcount leak in pep_sock_accep 2022-01-11 15:35:16 +01:00
psample
qrtr net: qrtr: start MHI channel after endpoit creation 2022-08-25 11:40:29 +02:00
rds net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks() 2022-10-26 12:34:49 +02:00
rfkill rfkill: make new event layout opt-in 2022-04-08 14:23:00 +02:00
rose rose: Fix NULL pointer dereference in rose_send_frame() 2022-11-10 18:15:29 +01:00
rxrpc rxrpc: Fix calc of resend age 2022-09-23 14:15:50 +02:00
sched net: sched: Fix use after free in red_enqueue() 2022-11-10 18:15:28 +01:00
sctp sctp: clear out_curr if all frag chunks of current msg are pruned 2022-12-02 17:40:59 +01:00
smc net/smc: Fix possible leaked pernet namespace in smc_init() 2022-11-10 18:15:31 +01:00
strparser bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding 2021-11-18 19:17:11 +01:00
sunrpc SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed 2022-11-10 18:15:26 +01:00
switchdev net: make switchdev_bridge_port_{,unoffload} loosely coupled with the bridge 2021-08-04 12:35:07 +01:00
tipc tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header 2022-11-16 09:58:19 +01:00
tls net/tls: Remove the context from the list in tls_device_down 2022-08-03 12:03:47 +02:00
unix af_unix: Fix memory leaks of the whole sk due to OOB skb. 2022-11-10 18:15:37 +01:00
vmw_vsock vsock: fix possible infinite sleep in vsock_connectible_wait_data() 2022-11-10 18:15:31 +01:00
wireless wifi: wext: use flex array destination for memcpy() 2022-11-26 09:24:51 +01:00
x25 net/x25: Fix skb leak in x25_lapb_receive_frame() 2022-11-26 09:24:41 +01:00
xdp xsk: Fix backpressure mechanism on Tx 2022-10-26 12:34:40 +02:00
xfrm xfrm: Update ipcomp_scratches with NULL when freed 2022-10-26 12:35:34 +02:00
Kconfig mctp: Add MCTP base 2021-07-29 15:06:49 +01:00
Makefile mctp: Add MCTP base 2021-07-29 15:06:49 +01:00
compat.c net: Return the correct errno code 2021-06-03 15:13:56 -07:00
devres.c net: devres: Correct a grammatical error 2021-06-11 12:55:28 -07:00
socket.c net: Fix a data-race around sysctl_somaxconn. 2022-08-31 17:16:45 +02:00
sysctl_net.c