CVE-2026-98947: vsock: Fix memory leak in vmci_transport_recv_dgram_cb()
In the Linux kernel, the following vulnerability has been resolved:
vsock: Fix memory leak in vmcitransportrecvdgramcb()
During the closure of a datagram socket, the vmcitransportrecvdgramcb() function may be called, which will add the packets to the socket's backlog; then, after the receive queue is cleared, the releasesock() function will move the packet back from the socket's backlog to the receive queue, which will lead to a memory leak.
sockclose sockrelease vsockrelease // take ownership by user-space locksocknested socksetflag(sk, SOCKDEAD) vmcitransportrelease vmcidispatchdgs vmcidatagraminvokeguesthandler vmcitransportrecvdgramcb skreceiveskb if (!sockownedbyuser(sk)) [...] (!) else if skaddbacklog() [...] (!) skbqueuepurge(&sk->skreceivequeue)
releasesock releasesock // move all packets from the backlog // to the receive queue (!) skbacklogrcv vsockqueuercvskb [...] sockqueuercvskb if (!sockflag(sk, SOCKDEAD)) // Since the socket is "dead", the function will not // be called sk->skdataready(sk) sockreleaseownership(sk); sockput
Add a receive queue cleanup in the socket destructor to fix this.
syzkaller report:
unreferenced object 0xffff8880117bfb80 (size 240): comm "irq/56-vmwvmci", pid 205, jiffies 4295064448 (age 73.992s) hex dump (first 32 bytes): 78 dc 26 1e 80 88 ff ff 78 dc 26 1e 80 88 ff ff x.&.....x.&..... 00 00 00 00 00 00 00 00 c0 da 26 1e 80 88 ff ff ..........&..... backtrace: [<ffffffff82be8d97>] allocskb+0x287/0x330 net/core/skbuff.c:505 [<ffffffffa114bcbd>] vmcitransportrecvdgramcb+0xbd/0x210 [vmwvsockvmcitransport] [<ffffffffa05072c6>] vmcidatagraminvokeguesthandler+0x366/0x450 [vmwvmci] [<ffffffffa050ad75>] vmcidispatchdgs+0x235/0x490 [vmwvmci] [<ffffffffa050b025>] vmciinterrupt+0x55/0x290 [vmwvmci] [<ffffffff8137ad2b>] irqthreadfn+0x8b/0x1a0 kernel/irq/manage.c:1205 [<ffffffff8137c7ae>] irqthread+0x28e/0x530 kernel/irq/manage.c:1314 [<ffffffff81253dd6>] kthread+0x2e6/0x3a0 kernel/kthread.c:376 [<ffffffff81004392>] retfromfork+0x22/0x30 arch/x86/entry/entry64.S:295
Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with Syzkaller.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Add receive-queue cleanup in the socket destructor for VMCI datagram sockets to prevent packets moved from the backlog to the receive queue from causing a memory leak; address vmci_transport_recv_dgram_cb() and the vsock socket release path.