In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: udc: Fix use-after-free in gadgetmatchdriver
The udc structure acts as the management structure for the gadget, but their lifecycles are decoupled. A race condition exists where usbdelgadget() frees the udc memory (e.g., via mode-switch work) while gadgetmatchdriver() concurrently accesses the freed udc memory (e.g., via configfs), causing a Use-After-Free (UAF) that triggers a NULL pointer dereference when the freed memory is zeroed:
[39430.908615][ T1171] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [39430.911397][ T1171] pc : pistrcmp+0x20/0x140 [39430.911441][ T1171] lr : gadgetmatchdriver+0x34/0x60 ... [39430.911890][ T1171] usbgadgetregisterdriverowner+0x50/0xf8 [39430.911910][ T1171] gadgetdevdescUDCstore+0xf4/0x140 [39430.931308][ T1171] configfswriteiter+0xec/0x134
[39430.957058][ T1171] Workqueue: eventsfreezable dwc3setmode [39430.957287][ T1171] dwc3gadgetexit+0x34/0x8c [39430.957304][ T1171] dwc3setmode+0xc0/0x664
Fix this by ensuring the udc structure remains allocated until the gadget is released. To achieve this, introduce a new usbgadgetrelease() routine to the core. When the gadget is added, usbaddgadget() stores the gadget's release routine in the udc structure and takes a reference to the udc. When the gadget is released, usbgadgetrelease() drops the reference to the udc and then calls the gadget's release routine.
drm/msm: always recover the gpu
In the Linux kernel, the following vulnerability has been resolved:
mptcp: allow subflow rcv wnd to shrink
In MPTCP connection, the window field in the TCP header refers to the MPTCP-level rcvnxt and it's right edge should not move backward. Such constraint is enforced at DSS option generation time.
At the same time, the TCP stack ensures independently that the TCP-level rcv wnd right's edge does not move backward. That in turn causes artificial inflating of the MPTCP rcv window when the incoming data is acked at the TCP level and is OoO in the MPTCP sequence space (or lands in the backlog).
As a consequence, the incoming traffic can exceed the receiver rcvbuf size even when the sender is not misbehaving.
Prevent such scenario forcibly allowing the TCP subflow to shrink the TCP-level rcv wnd regardless of the current netns setting.
In the Linux kernel, the following vulnerability has been resolved:
mtd: spi-nor: debugfs: fix out-of-bounds read in spinorparamsshow()
Sashiko noticed an out-of-bounds read [1].
In spinorparamsshow(), the snorfnames array is passed to spinorprintflags() using sizeof(snorfnames).
Since snorfnames is an array of pointers, sizeof() returns the total number of bytes occupied by the pointers (elementcount sizeof(void )) rather than the element count itself. On 64-bit systems, this makes the passed length 8x larger than intended.
Inside spinorprintflags(), the 'nameslen' argument is used to bounds-check the 'names' array access. An out-of-bounds read occurs if a flag bit is set that exceeds the array's actual element count but is within the inflated byte-size count.
Correct this by using ARRAYSIZE() to pass the actual number of string pointers in the array.
In the Linux kernel, the following vulnerability has been resolved:
spi: imx: fix use-after-free on unbind
The SPI subsystem frees the controller and any subsystem allocated driver data as part of deregistration (unless the allocation is device managed).
Take another reference before deregistering the controller so that the driver data is not freed until the driver is done with it.
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: Add spectre boundry for syscall dispatch table
The LoongArch syscall number is directly controlled by userspace, but does not have a arrayindexnospec() boundry to prevent access past the syscall function pointer tables.
In the Linux kernel, the following vulnerability has been resolved:
vhost: move vdpa group bound check to vhostvdpa
Remove duplication by consolidating these here. This reduces the posibility of a parent driver missing them.
While we're at it, fix a bug in vdpasim where a valid ASID can be assigned to a group equal to ngroups, causing an out of bound write.
In the Linux kernel, the following vulnerability has been resolved:
smb: client: prevent races in ->queryinterfaces()
It was possible for two query interface works to be concurrently trying to update the interfaces.
Prevent this by checking and updating ifacelastupdate under ifacelock.
In the Linux kernel, the following vulnerability has been resolved:
cxl/mbox: validate payload size before accessing contents in cxlpayloadfromuserallowed()
cxlpayloadfromuserallowed() casts and dereferences the input payload without first verifying its size. When a raw mailbox command is sent with an undersized payload (ie: 1 byte for CXLMBOXOPCLEARLOG, which expects a 16-byte UUID), uuidequal() reads past the allocated buffer, triggering a KASAN splat:
BUG: KASAN: slab-out-of-bounds in memcmp+0x176/0x1d0 lib/string.c:683 Read of size 8 at addr ffff88810130f5c0 by task syz.1.62/2258
CPU: 2 UID: 0 PID: 2258 Comm: syz.1.62 Not tainted 6.19.0-dirty #3 PREEMPT(voluntary) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dumpstack lib/dumpstack.c:94 [inline] dumpstacklvl+0xab/0xe0 lib/dumpstack.c:120 printaddressdescription mm/kasan/report.c:378 [inline] printreport+0xce/0x650 mm/kasan/report.c:482 kasanreport+0xce/0x100 mm/kasan/report.c:595 memcmp+0x176/0x1d0 lib/string.c:683 uuidequal include/linux/uuid.h:73 [inline] cxlpayloadfromuserallowed drivers/cxl/core/mbox.c:345 [inline] cxlmboxcmdctor drivers/cxl/core/mbox.c:368 [inline] cxlvalidatecmdfromuser drivers/cxl/core/mbox.c:522 [inline] cxlsendcmd+0x9c0/0xb50 drivers/cxl/core/mbox.c:643 cxlmemdevioctl drivers/cxl/core/memdev.c:698 [inline] cxlmemdevioctl+0x14f/0x190 drivers/cxl/core/memdev.c:713 vfsioctl fs/ioctl.c:51 [inline] dosysioctl fs/ioctl.c:597 [inline] sesysioctl fs/ioctl.c:583 [inline] x64sysioctl+0x18e/0x210 fs/ioctl.c:583 dosyscallx64 arch/x86/entry/syscall64.c:63 [inline] dosyscall64+0xa8/0x330 arch/x86/entry/syscall64.c:94 entrySYSCALL64afterhwframe+0x77/0x7f RIP: 0033:0x7fdaf331ba79 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fdaf1d77038 EFLAGS: 00000246 ORIGRAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fdaf3585fa0 RCX: 00007fdaf331ba79 RDX: 00002000000001c0 RSI: 00000000c030ce02 RDI: 0000000000000003 RBP: 00007fdaf33749df R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fdaf3586038 R14: 00007fdaf3585fa0 R15: 00007ffced2af768 </TASK>
Add 'insize' parameter to cxlpayloadfromuserallowed() and validate the payload is large enough.
In the Linux kernel, the following vulnerability has been resolved:
net: wwan: t7xx: fix potential skb->frags overflow in RX path
When receiving data in the DPMAIF RX path, the t7xxdpmaifsetfragtoskb() function adds page fragments to an skb without checking if the number of fragments has exceeded MAXSKBFRAGS. This could lead to a buffer overflow in skbshinfo(skb)->frags[] array, corrupting adjacent memory and potentially causing kernel crashes or other undefined behavior.
This issue was identified through static code analysis by comparing with a similar vulnerability fixed in the mt76 driver commit b102f0c522cf ("mt76: fix array overflow on receiving too many fragments for a packet").
The vulnerability could be triggered if the modem firmware sends packets with excessive fragments. While under normal protocol conditions (MTU 3080 bytes, BAT buffer 3584 bytes), a single packet should not require additional fragments, the kernel should not blindly trust firmware behavior. Malicious, buggy, or compromised firmware could potentially craft packets with more fragments than the kernel expects.
Fix this by adding a bounds check before calling skbaddrxfrag() to ensure nrfrags does not exceed MAXSKBFRAGS.
The check must be performed before unmapping to avoid a page leak and double DMA unmap during device teardown.
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nfconncount: update lastgc only when GC has been performed
Currently lastgc is being updated everytime a new connection is tracked, that means that it is updated even if a GC wasn't performed. With a sufficiently high packet rate, it is possible to always bypass the GC, causing the list to grow infinitely.
Update the lastgc value only when a GC has been actually performed.
In the Linux kernel, the following vulnerability has been resolved:
tcp: fix skbcopyubufs() vs BIG TCP
David Ahern reported crashes in skbcopyubufs() caused by TCP tx zerocopy using hugepages, and skb length bigger than ~68 KB.
skbcopyubufs() assumed it could copy all payload using up to MAXSKBFRAGS order-0 pages.
This assumption broke when BIG TCP was able to put up to 512 KB per skb.
We did not hit this bug at Google because we use CONFIGMAXSKBFRAGS=45 and limit gsomaxsize to 180000.
A solution is to use higher order pages if needed.
v2: add missing GFPCOMP, or we leak memory.
In the Linux kernel, the following vulnerability has been resolved:
mm/hugememory: do not clobber swpentryt during THP split
The following has been observed when running stressng mmap since commit b653db77350c ("mm: Clear page->private when splitting or migrating a page")
watchdog: BUG: soft lockup - CPU#75 stuck for 26s! [stress-ng:9546] CPU: 75 PID: 9546 Comm: stress-ng Tainted: G E 6.0.0-revert-b653db77-fix+ #29 0357d79b60fb09775f678e4f3f64ef0579ad1374 Hardware name: SGI.COM C2112-4GP3/X10DRT-P-Series, BIOS 2.0a 05/09/2016 RIP: 0010:xasdescend+0x28/0x80 Code: cc cc 0f b6 0e 48 8b 57 08 48 d3 ea 83 e2 3f 89 d0 48 83 c0 04 48 8b 44 c6 08 48 89 77 18 48 89 c1 83 e1 03 48 83 f9 02 75 08 <48> 3d fd 00 00 00 76 08 88 57 12 c3 cc cc cc cc 48 c1 e8 02 89 c2 RSP: 0018:ffffbbf02a2236a8 EFLAGS: 00000246 RAX: ffff9cab7d6a0002 RBX: ffffe04b0af88040 RCX: 0000000000000002 RDX: 0000000000000030 RSI: ffff9cab60509b60 RDI: ffffbbf02a2236c0 RBP: 0000000000000000 R08: ffff9cab60509b60 R09: ffffbbf02a2236c0 R10: 0000000000000001 R11: ffffbbf02a223698 R12: 0000000000000000 R13: ffff9cab4e28da80 R14: 0000000000039c01 R15: ffff9cab4e28da88 FS: 00007fab89b85e40(0000) GS:ffff9cea3fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fab84e00000 CR3: 00000040b73a4003 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> xasload+0x3a/0x50 filemapgetfolio+0x80/0x370 ? putswappage+0x163/0x360 pagecachegetpage+0x13/0x90 trytoreclaimswap+0x50/0x190 scanswapmapslots+0x31e/0x670 getswappages+0x226/0x3c0 folioallocswap+0x1cc/0x240 addtoswap+0x14/0x70 shrinkpagelist+0x968/0xbc0 reclaimpagelist+0x70/0xf0 reclaimpages+0xdd/0x120 madvisecoldorpageoutpterange+0x814/0xf30 walkpgdrange+0x637/0xa30 walkpagerange+0x142/0x170 walkpagerange+0x146/0x170 madvisepageout+0xb7/0x280 ? asmcommoninterrupt+0x22/0x40 madvisevmabehavior+0x3b7/0xac0 ? findvma+0x4a/0x70 ? findvma+0x64/0x70 ? madvisevmaanonname+0x40/0x40 madvisewalkvmas+0xa6/0x130 domadvise+0x2f4/0x360 x64sysmadvise+0x26/0x30 dosyscall64+0x5b/0x80 ? dosyscall64+0x67/0x80 ? syscallexittousermode+0x17/0x40 ? dosyscall64+0x67/0x80 ? syscallexittousermode+0x17/0x40 ? dosyscall64+0x67/0x80 ? dosyscall64+0x67/0x80 ? commoninterrupt+0x8b/0xa0 entrySYSCALL64afterhwframe+0x63/0xcd
The problem can be reproduced with the mmtests config config-workload-stressng-mmap. It does not always happen and when it triggers is variable but it has happened on multiple machines.
The intent of commit b653db77350c patch was to avoid the case where PGprivate is clear but folio->private is not-NULL. However, THP tail pages uses page->private for "swpentryt if foliotestswapcache()" as stated in the documentation for struct folio. This patch only clobbers page->private for tail pages if the head page was not in swapcache and warns once if page->private had an unexpected value.
In the Linux kernel, the following vulnerability has been resolved:
scsi: mpi3mr: Fix issues in mpi3mrgetalltgtinfo()
The function mpi3mrgetalltgtinfo() has four issues:
1) It calculates valid entry length in alltgtinfo assuming the header part of the struct mpi3mrdevicemapinfo would equal to sizeof(u32). The correct size is sizeof(u64).
2) When it calculates the valid entry length kernentrylen, it excludes one entry by subtracting 1 from numdevices.
3) It copies numdevice by calling memcpy(). Substitution is enough.
4) It does not specify the calculated length to sgcopyfrombuffer(). Instead, it specifies the payload length which is larger than the alltgtinfo size. It causes "BUG: KASAN: slab-out-of-bounds".
Fix the issues by using the correct header size, removing the subtraction from numdevices, replacing the memcpy() with substitution and specifying the correct length to sgcopyfrombuffer().
In the Linux kernel, the following vulnerability has been resolved:
lockd: set other missing fields when unlocking files
vfslockfile() expects the struct filelock to be fully initialised by the caller. Re-exported NFSv3 has been seen to Oops if the flfile field is NULL.
In the Linux kernel, the following vulnerability has been resolved:
In the Linux kernel, the following vulnerability has been resolved:
x86/sev: Evict cache lines during SNP memory validation
An SNP cache coherency vulnerability requires a cache line eviction mitigation when validating memory after a page state change to private. The specific mitigation is to touch the first and last byte of each 4K page that is being validated. There is no need to perform the mitigation when performing a page state change to shared and rescinding validation.
CPUID bit Fn8000001FEBX[31] defines the COHERENCYSFWNO CPUID bit that, when set, indicates that the software mitigation for this vulnerability is not needed.
Implement the mitigation and invoke it when validating memory (making it private) and the COHERENCYSFWNO bit is not set, indicating the SNP guest is vulnerable.
In the Linux kernel, the following vulnerability has been resolved:
ipmi:msghandler: Fix potential memory corruption in ipmicreateuser()
The "intf" list iterator is an invalid pointer if the correct "intf->intfnum" is not found. Calling atomicdec(&intf->nrusers) on and invalid pointer will lead to memory corruption.
We don't really need to call atomicdec() if we haven't called atomicaddreturn() so update the if (intf->inshutdown) path as well.
In the Linux kernel, the following vulnerability has been resolved:
bnxt: properly flush XDP redirect lists
We encountered following crash when testing a XDPREDIRECT feature in production:
[56251.579676] listadd corruption. next->prev should be prev (ffff93120dd40f30), but was ffffb301ef3a6740. (next=ffff93120dd 40f30). [56251.601413] ------------[ cut here ]------------ [56251.611357] kernel BUG at lib/listdebug.c:29! [56251.621082] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [56251.632073] CPU: 111 UID: 0 PID: 0 Comm: swapper/111 Kdump: loaded Tainted: P O 6.12.33-cloudflare-2025.6. 3 #1 [56251.653155] Tainted: [P]=PROPRIETARYMODULE, [O]=OOTMODULE [56251.663877] Hardware name: MiTAC GC68B-B8032-G11P6-GPU/S8032GM-HE-CFR, BIOS V7.020.B10-sig 01/22/2025 [56251.682626] RIP: 0010:listaddvalidorreport+0x4b/0xa0 [56251.693203] Code: 0e 48 c7 c7 68 e7 d9 97 e8 42 16 fe ff 0f 0b 48 8b 52 08 48 39 c2 74 14 48 89 f1 48 c7 c7 90 e7 d9 97 48 89 c6 e8 25 16 fe ff <0f> 0b 4c 8b 02 49 39 f0 74 14 48 89 d1 48 c7 c7 e8 e7 d9 97 4c 89 [56251.725811] RSP: 0018:ffff93120dd40b80 EFLAGS: 00010246 [56251.736094] RAX: 0000000000000075 RBX: ffffb301e6bba9d8 RCX: 0000000000000000 [56251.748260] RDX: 0000000000000000 RSI: ffff9149afda0b80 RDI: ffff9149afda0b80 [56251.760349] RBP: ffff9131e49c8000 R08: 0000000000000000 R09: ffff93120dd40a18 [56251.772382] R10: ffff9159cf2ce1a8 R11: 0000000000000003 R12: ffff911a80850000 [56251.784364] R13: ffff93120fbc7000 R14: 0000000000000010 R15: ffff9139e7510e40 [56251.796278] FS: 0000000000000000(0000) GS:ffff9149afd80000(0000) knlGS:0000000000000000 [56251.809133] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [56251.819561] CR2: 00007f5e85e6f300 CR3: 00000038b85e2006 CR4: 0000000000770ef0 [56251.831365] PKRU: 55555554 [56251.838653] Call Trace: [56251.845560] <IRQ> [56251.851943] cpumapenqueue.cold+0x5/0xa [56251.860243] xdpdoredirect+0x2d9/0x480 [56251.868388] bnxtrxxdp+0x1d8/0x4c0 [bnxten] [56251.877028] bnxtrxpkt+0x5f7/0x19b0 [bnxten] [56251.885665] ? cpumaxwrite+0x1e/0x100 [56251.893510] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.902276] bnxtpollwork+0x190/0x340 [bnxten] [56251.911058] bnxtpoll+0xab/0x1b0 [bnxten] [56251.919041] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.927568] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.935958] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.944250] napipoll+0x2b/0x160 [56251.951155] bpftrampoline6442548651+0x79/0x123 [56251.959262] napipoll+0x5/0x160 [56251.966037] netrxaction+0x3d2/0x880 [56251.973133] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.981265] ? srsoaliasreturnthunk+0x5/0xfbef5 [56251.989262] ? hrtimerrunqueues+0x162/0x2a0 [56251.996967] ? srsoaliasreturnthunk+0x5/0xfbef5 [56252.004875] ? srsoaliasreturnthunk+0x5/0xfbef5 [56252.012673] ? bnxtmsix+0x62/0x70 [bnxten] [56252.019903] handlesoftirqs+0xcf/0x270 [56252.026650] irqexitrcu+0x67/0x90 [56252.032933] commoninterrupt+0x85/0xa0 [56252.039498] </IRQ> [56252.044246] <TASK> [56252.048935] asmcommoninterrupt+0x26/0x40 [56252.055727] RIP: 0010:cpuidleenterstate+0xb8/0x420 [56252.063305] Code: dc 01 00 00 e8 f9 79 3b ff e8 64 f7 ff ff 49 89 c5 0f 1f 44 00 00 31 ff e8 a5 32 3a ff 45 84 ff 0f 85 ae 01 00 00 fb 45 85 f6 <0f> 88 88 01 00 00 48 8b 04 24 49 63 ce 4c 89 ea 48 6b f1 68 48 29 [56252.088911] RSP: 0018:ffff93120c97fe98 EFLAGS: 00000202 [56252.096912] RAX: ffff9149afd80000 RBX: ffff9141d3a72800 RCX: 0000000000000000 [56252.106844] RDX: 00003329176c6b98 RSI: ffffffe36db3fdc7 RDI: 0000000000000000 [56252.116733] RBP: 0000000000000002 R08: 0000000000000002 R09: 000000000000004e [56252.126652] R10: ffff9149afdb30c4 R11: 071c71c71c71c71c R12: ffffffff985ff860 [56252.136637] R13: 00003329176c6b98 R14: 0000000000000002 R15: 0000000000000000 [56252.146667] ? cpuidleenterstate+0xab/0x420 [56252.153909] cpuidleenter+0x2d/0x40 [56252.160360] doidle+0x176/0x1c0 [56252.166456 ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
KVM: x86/xen: Initialize Xen timer only once
Add a check for existing xen timers before initializing a new one.
Currently kvmxeninittimer() is called on every KVMXENVCPUATTRTYPETIMER, which is causing the following ODEBUG crash when vcpu->arch.xen.timer is already set.
ODEBUG: init active (active state 0) object type: hrtimer hint: xentimercallbac0 RIP: 0010:debugprintobject+0x16e/0x250 lib/debugobjects.c:502 Call Trace: debugobjectinit debughrtimerinit debuginit hrtimerinit kvmxeninittimer kvmxenvcpusetattr kvmarchvcpuioctl kvmvcpuioctl vfsioctl
In the Linux kernel, the following vulnerability has been resolved:
usbnet: Fix linkwatch use-after-free on disconnect
usbnet uses the work usbnetdeferredkevent() to perform tasks which may sleep. On disconnect, completion of the work was originally awaited in ->ndostop(). But in 2003, that was moved to ->disconnect() by historic commit "[PATCH] USB: usbnet, prevent exotic rtnl deadlock":
https://git.kernel.org/tglx/history/c/0f138bbfd83c
The change was made because back then, the kernel's workqueue implementation did not allow waiting for a single work. One had to wait for completion of all work by calling flushscheduledwork(), and that could deadlock when waiting for usbnetdeferredkevent() with rtnlmutex held in ->ndostop().
The commit solved one problem but created another: It causes a use-after-free in USB Ethernet drivers aqc111.c, asixdevices.c, ax88179178a.c, ch9200.c and smsc75xx.c:
If the drivers receive a link change interrupt immediately before disconnect, they raise EVENTLINKRESET in their (non-sleepable) ->status() callback and schedule usbnetdeferredkevent(). usbnetdeferredkevent() invokes the driver's ->linkreset() callback, which calls netifcarrier{on,off}(). That in turn schedules the work linkwatchevent().
Because usbnetdeferredkevent() is awaited after unregisternetdev(), netifcarrier{on,off}() may operate on an unregistered netdev and linkwatchevent() may run after freenetdev(), causing a use-after-free.
In 2010, usbnet was changed to only wait for a single instance of usbnetdeferredkevent() instead of all work by commit 23f333a2bfaf ("drivers/net: don't use flushscheduledwork()").
Unfortunately the commit neglected to move the wait back to ->ndostop(). Rectify that omission at long last.
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix KASAN use-after-free Read in computeeffectiveprogs
Syzbot found a Use After Free bug in computeeffectiveprogs(). The reproducer creates a number of BPF links, and causes a fault injected alloc to fail, while calling bpflinkdetach on them. Link detach triggers the link to be freed by bpflinkfree(), which calls cgroupbpfdetach() and updateeffectiveprogs(). If the memory allocation in this function fails, the function restores the pointer to the bpfcgrouplink on the cgroup list, but the memory gets freed just after it returns. After this, every subsequent call to updateeffectiveprogs() causes this already deallocated pointer to be dereferenced in proglistlength(), and triggers KASAN UAF error.
To fix this issue don't preserve the pointer to the prog or link in the list, but remove it and replace it with a dummy prog without shrinking the table. The subsequent call to cgroupbpfdetach() or cgroupbpfdetach() will correct it.
In the Linux kernel, the following vulnerability has been resolved:
scsi: sg: Allow waiting for commands to complete on removed device
When a SCSI device is removed while in active use, currently sg will immediately return -ENODEV on any attempt to wait for active commands that were sent before the removal. This is problematic for commands that use SGFLAGDIRECTIO since the data buffer may still be in use by the kernel when userspace frees or reuses it after getting ENODEV, leading to corrupted userspace memory (in the case of READ-type commands) or corrupted data being sent to the device (in the case of WRITE-type commands). This has been seen in practice when logging out of a iscsitcp session, where the iSCSI driver may still be processing commands after the device has been marked for removal.
Change the policy to allow userspace to wait for active sg commands even when the device is being removed. Return -ENODEV only when there are no more responses to read.
In the Linux kernel, the following vulnerability has been resolved:
coresight: Clear the connection field properly
coresight devices track their connections (output connections) and hold a reference to the fwnode. When a device goes away, we walk through the devices on the coresight bus and make sure that the references are dropped. This happens both ways: a) For all output connections from the device, drop the reference to the target device via coresightreleaseplatformdata()
b) Iterate over all the devices on the coresight bus and drop the reference to fwnode if this device is the target of the output connection, via coresightremoveconns()->coresightremovematch().
However, the coresightremovematch() doesn't clear the fwnode field, after dropping the reference, this causes use-after-free and additional refcount drops on the fwnode.
e.g., if we have two devices, A and B, with a connection, A -> B. If we remove B first, B would clear the reference on B, from A via coresightremovematch(). But when A is removed, it still has a connection with fwnode still pointing to B. Thus it tries to drops the reference in coresightreleaseplatformdata(), raising the bells like :
[ 91.990153] ------------[ cut here ]------------ [ 91.990163] refcountt: addition on 0; use-after-free. [ 91.990212] WARNING: CPU: 0 PID: 461 at lib/refcount.c:25 refcountwarnsaturate+0xa0/0x144 [ 91.990260] Modules linked in: coresightfunnel coresightreplicator coresightetm4x(-) crct10difce coresight iptables xtables ipv6 [last unloaded: coresightcpudebug] [ 91.990398] CPU: 0 PID: 461 Comm: rmmod Tainted: G W T 5.19.0-rc2+ #53 [ 91.990418] Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 [ 91.990434] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 91.990454] pc : refcountwarnsaturate+0xa0/0x144 [ 91.990476] lr : refcountwarnsaturate+0xa0/0x144 [ 91.990496] sp : ffff80000c843640 [ 91.990509] x29: ffff80000c843640 x28: ffff800009957c28 x27: ffff80000c8439a8 [ 91.990560] x26: ffff00097eff1990 x25: ffff8000092b6ad8 x24: ffff00097eff19a8 [ 91.990610] x23: ffff80000c8439a8 x22: 0000000000000000 x21: ffff80000c8439c2 [ 91.990659] x20: 0000000000000000 x19: ffff00097eff1a10 x18: ffff80000ab99c40 [ 91.990708] x17: 0000000000000000 x16: 0000000000000000 x15: ffff80000abf6fa0 [ 91.990756] x14: 000000000000001d x13: 0a2e656572662d72 x12: 657466612d657375 [ 91.990805] x11: 203b30206e6f206e x10: 6f69746964646120 x9 : ffff8000081aba28 [ 91.990854] x8 : 206e6f206e6f6974 x7 : 69646461203a745f x6 : 746e756f63666572 [ 91.990903] x5 : ffff00097648ec58 x4 : 0000000000000000 x3 : 0000000000000027 [ 91.990952] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00080260ba00 [ 91.991000] Call trace: [ 91.991012] refcountwarnsaturate+0xa0/0x144 [ 91.991034] kobjectget+0xac/0xb0 [ 91.991055] ofnodeget+0x2c/0x40 [ 91.991076] offwnodeget+0x40/0x60 [ 91.991094] fwnodehandleget+0x3c/0x60 [ 91.991116] fwnodegetnthparent+0xf4/0x110 [ 91.991137] fwnodefullnamestring+0x48/0xc0 [ 91.991158] devicenodestring+0x41c/0x530 [ 91.991178] pointer+0x320/0x3ec [ 91.991198] vsnprintf+0x23c/0x750 [ 91.991217] vprintkstore+0x104/0x4b0 [ 91.991238] vprintkemit+0x8c/0x360 [ 91.991257] vprintkdefault+0x44/0x50 [ 91.991276] vprintk+0xcc/0xf0 [ 91.991295] printk+0x68/0x90 [ 91.991315] ofnoderelease+0x13c/0x14c [ 91.991334] kobjectput+0x98/0x114 [ 91.991354] ofnodeput+0x24/0x34 [ 91.991372] offwnodeput+0x40/0x5c [ 91.991390] fwnodehandleput+0x38/0x50 [ 91.991411] coresightreleaseplatformdata+0x74/0xb0 [coresight] [ 91.991472] coresightunregister+0x64/0xcc [coresight] [ 91.991525] etm4removedev+0x64/0x78 [coresightetm4x] [ 91.991563] etm4removeamba+0x1c/0x2c [coresightetm4x] [ 91.991598] ambaremove+0x3c/0x19c ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nftables: do not allow SETID to refer to another table
When doing lookups for sets on the same batch by using its ID, a set from a different table can be used.
Then, when the table is removed, a reference to the set may be kept after the set is freed, leading to a potential use-after-free.
When looking for sets by ID, use the table that was used for the lookup by name, and only return sets belonging to that same table.
This fixes CVE-2022-2586, also reported as ZDI-CAN-17470.
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nftables: do not allow CHAINID to refer to another table
When doing lookups for chains on the same batch by using its ID, a chain from a different table can be used. If a rule is added to a table but refers to a chain in a different table, it will be linked to the chain in table2, but would have expressions referring to objects in table1.
Then, when table1 is removed, the rule will not be removed as its linked to a chain in table2. When expressions in the rule are processed or removed, that will lead to a use-after-free.
When looking for chains by ID, use the table that was used for the lookup by name, and only return chains belonging to that same table.
In the Linux kernel, the following vulnerability has been resolved:
md-raid10: fix KASAN warning
There's a KASAN warning in raid10removedisk when running the lvm test lvconvert-raid-reshape.sh. We fix this warning by verifying that the value "number" is valid.
BUG: KASAN: slab-out-of-bounds in raid10removedisk+0x61/0x2a0 [raid10] Read of size 8 at addr ffff889108f3d300 by task mdXraid10/124682
CPU: 3 PID: 124682 Comm: mdXraid10 Not tainted 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Call Trace: <TASK> dumpstacklvl+0x34/0x44 printreport.cold+0x45/0x57a ? locktextstart+0x18/0x18 ? raid10removedisk+0x61/0x2a0 [raid10] kasanreport+0xa8/0xe0 ? raid10removedisk+0x61/0x2a0 [raid10] raid10removedisk+0x61/0x2a0 [raid10] Buffer I/O error on dev dm-76, logical block 15344, async page read ? mutexunlockslowpath.constprop.0+0x1e0/0x1e0 removeandaddspares+0x367/0x8a0 [mdmod] ? superwritten+0x1c0/0x1c0 [mdmod] ? mutextrylock+0xac/0x120 ? rawspinlock+0x72/0xc0 ? rawspinlockbh+0xc0/0xc0 mdcheckrecovery+0x848/0x960 [mdmod] raid10d+0xcf/0x3360 [raid10] ? schedclockcpu+0x185/0x1a0 ? rberase+0x4d4/0x620 ? varwakefunction+0xe0/0xe0 ? psigroupchange+0x411/0x500 ? preemptcountsub+0xf/0xc0 ? rawspinlockirqsave+0x78/0xc0 ? locktextstart+0x18/0x18 ? raid10syncrequest+0x36c0/0x36c0 [raid10] ? preemptcountsub+0xf/0xc0 ? rawspinunlockirqrestore+0x19/0x40 ? deltimersync+0xa9/0x100 ? trytodeltimersync+0xc0/0xc0 ? rawspinlockirqsave+0x78/0xc0 ? locktextstart+0x18/0x18 ? rawspinunlockirq+0x11/0x24 ? listdelentryvalid+0x68/0xa0 ? finishwait+0xa3/0x100 mdthread+0x161/0x260 [mdmod] ? unregistermdpersonality+0xa0/0xa0 [mdmod] ? rawspinlockirqsave+0x78/0xc0 ? preparetowaitevent+0x2c0/0x2c0 ? unregistermdpersonality+0xa0/0xa0 [mdmod] kthread+0x148/0x180 ? kthreadcompleteandexit+0x20/0x20 retfromfork+0x1f/0x30 </TASK>
Allocated by task 124495: kasansavestack+0x1e/0x40 kasankmalloc+0x80/0xa0 setupconf+0x140/0x5c0 [raid10] raid10run+0x4cd/0x740 [raid10] mdrun+0x6f9/0x1300 [mdmod] raidctr+0x2531/0x4ac0 [dmraid] dmtableaddtarget+0x2b0/0x620 [dmmod] tableload+0x1c8/0x400 [dmmod] ctlioctl+0x29e/0x560 [dmmod] dmcompatctlioctl+0x7/0x20 [dmmod] docompatsysioctl+0xfa/0x160 dosyscall64+0x90/0xc0 entrySYSCALL64afterhwframe+0x46/0xb0
Last potentially related work creation: kasansavestack+0x1e/0x40 kasanrecordauxstack+0x9e/0xc0 kvfreecallrcu+0x84/0x480 timerfdrelease+0x82/0x140 L fput+0xfa/0x400 taskworkrun+0x80/0xc0 exittousermodeprepare+0x155/0x160 syscallexittousermode+0x12/0x40 dosyscall64+0x42/0xc0 entrySYSCALL64afterhwframe+0x46/0xb0
Second to last potentially related work creation: kasansavestack+0x1e/0x40 kasanrecordauxstack+0x9e/0xc0 kvfreecallrcu+0x84/0x480 timerfdrelease+0x82/0x140 fput+0xfa/0x400 taskworkrun+0x80/0xc0 exittousermodeprepare+0x155/0x160 syscallexittousermode+0x12/0x40 dosyscall64+0x42/0xc0 entrySYSCALL64afterhwframe+0x46/0xb0
The buggy address belongs to the object at ffff889108f3d200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes to the right of 256-byte region [ffff889108f3d200, ffff889108f3d300)
The buggy address belongs to the physical page: page:000000007ef2a34c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1108f3c head:000000007ef2a34c order:2 compoundmapcount:0 compoundpincount:0 flags: 0x4000000000010200(slab|head|zone=2) raw: 4000000000010200 0000000000000000 dead000000000001 ffff889100042b40 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected
Memory state around the buggy address: ffff889108f3d200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff889108f3d280: 00 00 ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
ext2: Add more validity checks for inode counts
Add checks verifying number of inodes stored in the superblock matches the number computed from number of inodes per group. Also verify we have at least one block worth of inodes per group. This prevents crashes on corrupted filesystems.
In the Linux kernel, the following vulnerability has been resolved:
selinux: Add boundary check in putentry()
Just like nextentry(), boundary check is necessary to prevent memory out-of-bound access.
In the Linux kernel, the following vulnerability has been resolved:
spi: tegra20-slink: fix UAF in tegraslinkremove()
After calling spiunregistermaster(), the refcount of master will be decrease to 0, and it will be freed in spicontrollerrelease(), the device data also will be freed, so it will lead a UAF when using 'tspi'. To fix this, get the master before unregister and put it when finish using it.