summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/elf_kexec.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2023-09-12 04:27:53 +0200
committerPaolo Abeni <pabeni@redhat.com>2023-09-14 10:43:51 +0200
commita22730b1b4bf437c6bbfdeff5feddf54be4aeada (patch)
treee50697c49bf688e10ed97ddbd4cea6ab4c84c956 /arch/riscv/kernel/elf_kexec.c
parentMerge branch 'net-renesas-rswitch-fix-a-lot-of-redundant-irq-issue' (diff)
downloadlinux-a22730b1b4bf437c6bbfdeff5feddf54be4aeada.tar.xz
linux-a22730b1b4bf437c6bbfdeff5feddf54be4aeada.zip
kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
syzkaller found a memory leak in kcm_sendmsg(), and commit c821a88bd720 ("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: c821a88bd720 ("kcm: Fix memory leak in error path of kcm_sendmsg()") Fixes: ab7ac4eb9832 ("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>
Diffstat (limited to 'arch/riscv/kernel/elf_kexec.c')
0 files changed, 0 insertions, 0 deletions