linux/net
Kuniyuki Iwashima a22730b1b4 kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
syzkaller found a memory leak in kcm_sendmsg(), and commit c821a88bd7
("kcm: Fix memory leak in error path of kcm_sendmsg()") suppressed it by
updating kcm_tx_msg(head)->last_skb if partial data is copied so that the
following sendmsg() will resume from the skb.

However, we cannot know how many bytes were copied when we get the error.
Thus, we could mess up the MSG_MORE queue.

When kcm_sendmsg() fails for SOCK_DGRAM, we should purge the queue as we
do so for UDP by udp_flush_pending_frames().

Even without this change, when the error occurred, the following sendmsg()
resumed from a wrong skb and the queue was messed up.  However, we have
yet to get such a report, and only syzkaller stumbled on it.  So, this
can be changed safely.

Note this does not change SOCK_SEQPACKET behaviour.

Fixes: c821a88bd7 ("kcm: Fix memory leak in error path of kcm_sendmsg()")
Fixes: ab7ac4eb98 ("kcm: Kernel Connection Multiplexor module")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230912022753.33327-1-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-09-14 10:43:51 +02:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bpf
bpfilter
bridge
caif
can
ceph
core Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
dcb net: dcb: choose correct policy to parse DCB_ATTR_BCN 2023-08-01 21:07:46 -07:00
dccp
devlink
dns_resolver
dsa
ethernet
ethtool ethtool: netlink: always pass genl_info to .prepare_data 2023-08-15 15:01:03 -07:00
handshake
hsr hsr: Fix uninit-value access in fill_frame_info() 2023-09-11 08:28:36 +01:00
ieee802154
ife
ipv4 tcp: Fix bind() regression for v4-mapped-v6 non-wildcard address. 2023-09-13 07:18:04 +01:00
ipv6 Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
iucv
kcm kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg(). 2023-09-14 10:43:51 +02:00
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mctp
mpls
mptcp Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
ncsi
netfilter Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
netlabel
netlink
netrom netrom: Deny concurrent connect(). 2023-08-28 06:58:46 +01:00
nfc
nsh
openvswitch
packet
phonet
psample
qrtr
rds sysctl-6.6-rc1 2023-08-29 17:39:15 -07:00
rfkill
rose
rxrpc
sched
sctp Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
smc net/smc: use smc_lgr_list.lock to protect smc_lgr_list.list iterate in smcr_port_add 2023-09-10 19:31:42 +01:00
strparser
sunrpc
switchdev
tipc
tls net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict() 2023-09-12 09:51:49 +02:00
unix Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
vmw_vsock
wireless
x25
xdp
xfrm
Kconfig
Kconfig.debug
Makefile
compat.c
devres.c
socket.c Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
sysctl_net.c