In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: btrtl: fix out of bounds memory access
The Linux kernel CVE team has assigned CVE-2024-26890 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024041742-CVE-2024-26890-4239@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
block: bio-integrity: Fix null-ptr-deref in biointegritymapuser()
pinuserpagesfast() can partially succeed and return the number of pages that were actually pinned. However, the biointegritymapuser() does not handle this partial pinning. This leads to a general protection fault since bvecfrompages() dereferences an unpinned page address, which is 0.
To fix this, add a check to verify that all requested memory is pinned. If partial pinning occurs, unpin the memory and return -EFAULT.
Kernel Oops:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 UID: 0 PID: 1061 Comm: nvme-passthroug Not tainted 7.0.0-11783-g90957f9314e8-dirty #16 PREEMPT(lazy) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 RIP: 0010:biointegritymapuser.cold+0x1b0/0x9d6
In the Linux kernel, the following vulnerability has been resolved:
xsk: cache csumstart/csumoffset to fix TOCTOU in xskskbmetadata()
The TX metadata area resides in the UMEM buffer which is memory-mapped and concurrently writable by userspace. In xskskbmetadata(), csumstart and csumoffset are read from shared memory for bounds validation, then read again for skb assignment. A malicious userspace application can race to overwrite these values between the two reads, bypassing the bounds check and causing out-of-bounds memory access during checksum computation in the transmit path.
Fix this by reading csumstart and csumoffset into local variables once, then using the local copies for both validation and assignment.
Note that other metadata fields (flags, launchtime) and the cached csum fields may be mutually inconsistent due to concurrent userspace writes, but this is benign: the only security-critical invariant is that each field's validated value is the same one used, which local caching guarantees.
In the Linux kernel, the following vulnerability has been resolved:
media: chips-media: wave5: Fix Null reference while testing fluster
When multi instances are created/destroyed, many interrupts happens and structures for decoder are removed. "struct vpuinstance" this structure is shared for all flow in the decoder, so if the structure is not protected by lock, Null dereference could happens sometimes. IRQ Handler was spilt to two phases and Lock was added as well.
In the Linux kernel, the following vulnerability has been resolved:
bnxten: set backing store type from query type
bnxthwrmfuncbackingstoreqcapsv2() stores resp->type from the firmware response in ctxm->type and later uses that value to index fixed backing-store metadata arrays such as ctxarr[] and bnxtbstoretotrace[].
ctxm->type is fixed by the current backing-store query type and matches the array index of ctx->ctxarr. Set ctxm->type from the current loop variable instead of depending on resp->type.
Also update the loop to advance type from nextvalidtype in the for statement, which keeps the control flow simpler for non-valid and unchanged entries.
In the Linux kernel, the following vulnerability has been resolved:
accel/ivpu: Prevent recovery work from being queued during device removal
Use disableworksync() instead of cancelworksync() in ivpudevfini() to ensure that no new recovery work items can be queued after device removal has started. Previously, recovery work could be scheduled even after canceling existing work, potentially leading to use-after-free bugs if recovery accessed freed resources.
Rename ivpupmcancelrecovery() to ivpupmdisablerecovery() to better reflect its new behavior.
In the Linux kernel, the following vulnerability has been resolved:
netfs: Only create /proc/fs/netfs with CONFIGPROCFS
When testing a special config:
CONFIGNETFSSUPPORTS=y CONFIGPROCFS=n
The system crashes with something like:
[ 3.766197] ------------[ cut here ]------------ [ 3.766484] kernel BUG at mm/mempool.c:560! [ 3.766789] Oops: invalid opcode: 0000 [#1] SMP NOPTI [ 3.767123] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W [ 3.767777] Tainted: [W]=WARN [ 3.767968] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), [ 3.768523] RIP: 0010:mempoolallocslab.cold+0x17/0x19 [ 3.768847] Code: 50 fe ff 58 5b 5d 41 5c 41 5d 41 5e 41 5f e9 93 95 13 00 [ 3.769977] RSP: 0018:ffffc90000013998 EFLAGS: 00010286 [ 3.770315] RAX: 000000000000002f RBX: ffff888100ba8640 RCX: 0000000000000000 [ 3.770749] RDX: 0000000000000000 RSI: 0000000000000003 RDI: 00000000ffffffff [ 3.771217] RBP: 0000000000092880 R08: 0000000000000000 R09: ffffc90000013828 [ 3.771664] R10: 0000000000000001 R11: 00000000ffffffea R12: 0000000000092cc0 [ 3.772117] R13: 0000000000000400 R14: ffff8881004b1620 R15: ffffea0004ef7e40 [ 3.772554] FS: 0000000000000000(0000) GS:ffff8881b5f3c000(0000) knlGS:0000000000000000 [ 3.773061] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.773443] CR2: ffffffff830901b4 CR3: 0000000004296001 CR4: 0000000000770ef0 [ 3.773884] PKRU: 55555554 [ 3.774058] Call Trace: [ 3.774232] <TASK> [ 3.774371] mempoolallocnoprof+0x6a/0x190 [ 3.774649] ? printk+0x57/0x80 [ 3.774862] netfsallocrequest+0x85/0x2ce [ 3.775147] netfsreadahead+0x28/0x170 [ 3.775395] readpages+0x6c/0x350 [ 3.775623] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.775928] pagecacheraunbounded+0x1bd/0x2a0 [ 3.776247] filemapgetpages+0x139/0x970 [ 3.776510] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.776820] filemapread+0xf9/0x580 [ 3.777054] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.777368] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.777674] ? findheldlock+0x32/0x90 [ 3.777929] ? netfsstartioread+0x19/0x70 [ 3.778221] ? netfsstartioread+0x19/0x70 [ 3.778489] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.778800] ? lockacquired+0x1e6/0x450 [ 3.779054] ? srsoaliasreturnthunk+0x5/0xfbef5 [ 3.779379] netfsbufferedreaditer+0x57/0x80 [ 3.779670] kernelread+0x158/0x2c0 [ 3.779927] bprmexecve+0x300/0x7a0 [ 3.780185] kernelexecve+0x10c/0x140 [ 3.780423] ? pfxkernelinit+0x10/0x10 [ 3.780690] kernelinit+0xd5/0x150 [ 3.780910] retfromfork+0x2d/0x50 [ 3.781156] ? pfxkernelinit+0x10/0x10 [ 3.781414] retfromforkasm+0x1a/0x30 [ 3.781677] </TASK> [ 3.781823] Modules linked in: [ 3.782065] ---[ end trace 0000000000000000 ]---
This is caused by the following error path in netfsinit():
if (!procmkdir("fs/netfs", NULL)) goto errorproc;
Fix this by adding ifdef in netfsmain(), so that /proc/fs/netfs is only created with CONFIGPROCFS.
In the Linux kernel, the following vulnerability has been resolved:
md/dm-raid: don't call mdreapsyncthread() directly
Currently mdreapsyncthread() is called from raidmessage() directly without holding 'reconfigmutex', this is definitely unsafe because mdreapsyncthread() can change many fields that is protected by 'reconfigmutex'.
However, hold 'reconfigmutex' here is still problematic because this will cause deadlock, for example, commit 130443d60b1b ("md: refactor idle/frozensyncthread() to fix deadlock").
Fix this problem by using stopsyncthread() to unregister syncthread, like md/raid did.
In the Linux kernel, the following vulnerability has been resolved:
nvme: fix reconnection fail due to reserved tag allocation
The Linux kernel CVE team has assigned CVE-2024-27435 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024051710-CVE-2024-27435-c465@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
x86/fpu: Keep xfdstate in sync with MSRIA32XFD
Commit 672365477ae8 ("x86/fpu: Update XFD state where required") and commit 8bf26758ca96 ("x86/fpu: Add XFD state to fpstate") introduced a per CPU variable xfdstate to keep the MSRIA32XFD value cached, in order to avoid unnecessary writes to the MSR.
On CPU hotplug MSRIA32XFD is reset to the initfpstate.xfd, which wipes out any stale state. But the per CPU cached xfd value is not reset, which brings them out of sync.
As a consequence a subsequent xfdupdatestate() might fail to update the MSR which in turn can result in XRSTOR raising a #NM in kernel space, which crashes the kernel.
To fix this, introduce xfdsetstate() to write xfdstate together with MSRIA32XFD, and use it in all places that set MSRIA32XFD.
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to avoid potential panic during recovery
During recovery, if FAULTBLOCK is on, it is possible that f2fsreservenewblock() will return -ENOSPC during recovery, then it may trigger panic.
Also, if fault injection rate is 1 and only FAULTBLOCK fault type is on, it may encounter deadloop in loop of block reservation.
Let's change as below to fix these issues: - remove bugon() to avoid panic. - limit the loop count of block reservation to avoid potential deadloop.
f2fs: compress: fix to guarantee persisting compressed blocks by CP
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix slab-out-of-bounds in smbstrndupfromutf16()
If ->NameOffset of smb2createreq is smaller than Buffer offset of smb2createreq, slab-out-of-bounds read can happen from smb2open. This patch set the minimum value of the name offset to the buffer offset to validate name length of smb2createreq().
In the Linux kernel, the following vulnerability has been resolved:
s390/zcrypt: fix reference counting on zcrypt card objects
Tests with hot-plugging crytpo cards on KVM guests with debug kernel build revealed an use after free for the load field of the struct zcryptcard. The reason was an incorrect reference handling of the zcrypt card object which could lead to a free of the zcrypt card object while it was still in use.
This is an example of the slab message:
kernel: 0x00000000885a7512-0x00000000885a7513 @offset=1298. First byte 0x68 instead of 0x6b kernel: Allocated in zcryptcardalloc+0x36/0x70 [zcrypt] age=18046 cpu=3 pid=43 kernel: kmalloctrace+0x3f2/0x470 kernel: zcryptcardalloc+0x36/0x70 [zcrypt] kernel: zcryptcex4cardprobe+0x26/0x380 [zcryptcex4] kernel: apdeviceprobe+0x15c/0x290 kernel: reallyprobe+0xd2/0x468 kernel: driverprobedevice+0x40/0xf0 kernel: deviceattachdriver+0xc0/0x140 kernel: busforeachdrv+0x8c/0xd0 kernel: deviceattach+0x114/0x198 kernel: busprobedevice+0xb4/0xc8 kernel: deviceadd+0x4d2/0x6e0 kernel: apscanadapter+0x3d0/0x7c0 kernel: apscanbus+0x5a/0x3b0 kernel: apscanbuswqcallback+0x40/0x60 kernel: processonework+0x26e/0x620 kernel: workerthread+0x21c/0x440 kernel: Freed in zcryptcardput+0x54/0x80 [zcrypt] age=9024 cpu=3 pid=43 kernel: kfree+0x37e/0x418 kernel: zcryptcardput+0x54/0x80 [zcrypt] kernel: apdeviceremove+0x4c/0xe0 kernel: devicereleasedriverinternal+0x1c4/0x270 kernel: busremovedevice+0x100/0x188 kernel: devicedel+0x164/0x3c0 kernel: deviceunregister+0x30/0x90 kernel: apscanadapter+0xc8/0x7c0 kernel: apscanbus+0x5a/0x3b0 kernel: apscanbuswqcallback+0x40/0x60 kernel: processonework+0x26e/0x620 kernel: workerthread+0x21c/0x440 kernel: kthread+0x150/0x168 kernel: retfromfork+0x3c/0x58 kernel: retfromfork+0xa/0x30 kernel: Slab 0x00000372022169c0 objects=20 used=18 fp=0x00000000885a7c88 flags=0x3ffff00000000a00(workingset|slab|node=0|zone=1|lastcpupid=0x1ffff) kernel: Object 0x00000000885a74b8 @offset=1208 fp=0x00000000885a7c88 kernel: Redzone 00000000885a74b0: bb bb bb bb bb bb bb bb ........ kernel: Object 00000000885a74b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk kernel: Object 00000000885a74c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk kernel: Object 00000000885a74d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk kernel: Object 00000000885a74e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk kernel: Object 00000000885a74f8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk kernel: Object 00000000885a7508: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 68 4b 6b 6b 6b a5 kkkkkkkkkkhKkkk. kernel: Redzone 00000000885a7518: bb bb bb bb bb bb bb bb ........ kernel: Padding 00000000885a756c: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZ kernel: CPU: 0 PID: 387 Comm: systemd-udevd Not tainted 6.8.0-HF #2 kernel: Hardware name: IBM 3931 A01 704 (KVM/Linux) kernel: Call Trace: kernel: [<00000000ca5ab5b8>] dumpstacklvl+0x90/0x120 kernel: [<00000000c99d78bc>] checkbytesandreport+0x114/0x140 kernel: [<00000000c99d53cc>] checkobject+0x334/0x3f8 kernel: [<00000000c99d820c>] allocdebugprocessing+0xc4/0x1f8 kernel: [<00000000c99d852e>] getpartialnode.part.0+0x1ee/0x3e0 kernel: [<00000000c99d94ec>] slaballoc+0xaf4/0x13c8 kernel: [<00000000c99d9e38>] slaballoc.constprop.0+0x78/0xb8 kernel: [<00000000c99dc8dc>] kmalloc+0x434/0x590 kernel: [<00000000c9b4c0ce>] ext4htreestoredirent+0x4e/0x1c0 kernel: [<00000000c9b908a2>] htreedirblocktotree+0x17a/0x3f0 kernel: ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
media: ttpci: fix two memleaks in budgetavattach
When saa7146registerdevice and saa7146vvinit fails, budgetavattach should free the resources it allocates, like the error-handling of ttpcibudgetinit does. Besides, there are two fixme comment refers to such deallocations.
bpf: Fix stackmap overflow check on 32-bit arches
In the Linux kernel, the following vulnerability has been resolved:
RDMA/srpt: Do not register event handler until srpt device is fully setup
The Linux kernel CVE team has assigned CVE-2024-26872 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024041738-CVE-2024-26872-2d38@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
mac802154: fix llsec key resources release in mac802154llseckeydel
mac802154llseckeydel() can free resources of a key directly without following the RCU rules for waiting before the end of a grace period. This may lead to use-after-free in case llseclookupkey() is traversing the list of keys in parallel with a key deletion:
refcountt: addition on 0; use-after-free. WARNING: CPU: 4 PID: 16000 at lib/refcount.c:25 refcountwarnsaturate+0x162/0x2a0 Modules linked in: CPU: 4 PID: 16000 Comm: wpan-ping Not tainted 6.7.0 #19 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:refcountwarnsaturate+0x162/0x2a0 Call Trace: llseclookupkey.isra.0+0x890/0x9e0 mac802154llsecencrypt+0x30c/0x9c0 ieee802154subifstartxmit+0x24/0x1e0 devhardstartxmit+0x13e/0x690 schdirectxmit+0x2ae/0xbc0 devqueuexmit+0x11dd/0x3c20 dgramsendmsg+0x90b/0xd60 syssendto+0x466/0x4c0 x64syssendto+0xe0/0x1c0 dosyscall64+0x45/0xf0 entrySYSCALL64afterhwframe+0x6e/0x76
Also, ieee802154llseckeyentry structures are not freed by mac802154llseckeydel():
unreferenced object 0xffff8880613b6980 (size 64): comm "iwpan", pid 2176, jiffies 4294761134 (age 60.475s) hex dump (first 32 bytes): 78 0d 8f 18 80 88 ff ff 22 01 00 00 00 00 ad de x......."....... 00 00 00 00 00 00 00 00 03 00 cd ab 00 00 00 00 ................ backtrace: [] kmemcacheallocnode+0x1e2/0x2d0 [] kmalloctrace+0x25/0xc0 [] mac802154llseckeyadd+0xac9/0xcf0 [] ieee802154addllseckey+0x5a/0x80 [] nl802154addllseckey+0x426/0x5b0 [] genlfamilyrcvmsgdoit+0x1fe/0x2f0 [] genlrcvmsg+0x531/0x7d0 [] netlinkrcvskb+0x169/0x440 [] genlrcv+0x28/0x40 [] netlinkunicast+0x53c/0x820 [] netlinksendmsg+0x93b/0xe60 [] syssendmsg+0xac5/0xca0 [] syssendmsg+0x11d/0x1c0 [] syssendmsg+0xfa/0x1d0 [] dosyscall64+0x45/0xf0 [] entrySYSCALL64afterhwframe+0x6e/0x76
Handle the proper resource release in the RCU callback function mac802154llseckeydelrcu().
Note that if llseclookupkey() finds a key, it gets a refcount via llseckeyget() and locally copies key id from keyentry (which is a list element). So it's safe to call llseckeyput() and free the list entry after the RCU grace period elapses.
Found by Linux Verification Center (linuxtesting.org).
clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays
In the Linux kernel, the following vulnerability has been resolved:
wifi: rtl8xxxu: add cancelworksync() for c2hcmdwork
The Linux kernel CVE team has assigned CVE-2024-27052 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024050115-CVE-2024-27052-fb6d@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
media: dvb-frontends: avoid stack overflow warnings with clang
A previous patch worked around a KASAN issue in stv0367, now a similar problem showed up with clang:
drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367tersetfrontend' [-Werror,-Wframe-larger-than] 1214 | static int stv0367tersetfrontend(struct dvbfrontend fe)
Rework the stv0367writereg() function to be simpler and mark both register access functions as noinlineforstack so the temporary i2cmsg structures do not get duplicated on the stack when KASANSTACK is enabled.
In the Linux kernel, the following vulnerability has been resolved:
nfs: fix UAF in direct writes
In production we have been hitting the following warning consistently
------------[ cut here ]------------ refcountt: underflow; use-after-free. WARNING: CPU: 17 PID: 1800359 at lib/refcount.c:28 refcountwarnsaturate+0x9c/0xe0 Workqueue: nfsiod nfsdirectwriteschedulework [nfs] RIP: 0010:refcountwarnsaturate+0x9c/0xe0 PKRU: 55555554 Call Trace: ? warn+0x9f/0x130 ? refcountwarnsaturate+0x9c/0xe0 ? reportbug+0xcc/0x150 ? handlebug+0x3d/0x70 ? excinvalidop+0x16/0x40 ? asmexcinvalidop+0x16/0x20 ? refcountwarnsaturate+0x9c/0xe0 nfsdirectwriteschedulework+0x237/0x250 [nfs] processonework+0x12f/0x4a0 workerthread+0x14e/0x3b0 ? ZSTDgetCParamsinternal+0x220/0x220 kthread+0xdc/0x120 ? btfnamevalid+0xa0/0xa0 retfromfork+0x1f/0x30
This is because we're completing the nfsdirectrequest twice in a row.
The source of this is when we have our commit requests to submit, we process them and send them off, and then in the completion path for the commit requests we have
if (nfscommitend(cinfo.mds)) nfsdirectwritecomplete(dreq);
However since we're submitting asynchronous requests we sometimes have one that completes before we submit the next one, so we end up calling complete on the nfsdirectrequest twice.
The only other place we use nfsgenericcommitlist() is in nfscommitinode, which wraps this call in a
nfscommitbegin(); nfscommitend();
Which is a common pattern for this style of completion handling, one that is also repeated in the direct code with getdreq()/putdreq() calls around where we process events as well as in the completion paths.
Fix this by using the same pattern for the commit requests.
Before with my 200 node rocksdb stress running this warning would pop every 10ish minutes. With my patch the stress test has been running for several hours without popping.
In the Linux kernel, the following vulnerability has been resolved:
wifi: mac80211: check/clear fast rx for non-4addr sta VLAN changes
The Linux kernel CVE team has assigned CVE-2024-35789 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024051707-CVE-2024-35789-52e5@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
KVM: Always flush async #PF workqueue when vCPU is being destroyed
Always flush the per-vCPU async #PF workqueue when a vCPU is clearing its completion queue, e.g. when a VM and all its vCPUs is being destroyed. KVM must ensure that none of its workqueue callbacks is running when the last reference to the KVM module is put. Gifting a reference to the associated VM prevents the workqueue callback from dereferencing freed vCPU/VM memory, but does not prevent the KVM module from being unloaded before the callback completes.
Drop the misguided VM refcount gifting, as calling kvmputkvm() from asyncpfexecute() if kvmputkvm() flushes the async #PF workqueue will result in deadlock. asyncpfexecute() can't return until kvmputkvm() finishes, and kvmputkvm() can't return until asyncpfexecute() finishes:
WARNING: CPU: 8 PID: 251 at virt/kvm/kvmmain.c:1435 kvmputkvm+0x2d/0x320 [kvm] Modules linked in: vhostnet vhost vhostiotlb tap kvmintel kvm irqbypass CPU: 8 PID: 251 Comm: kworker/8:1 Tainted: G W 6.6.0-rc1-e7af8d17224a-x86/gmem-vm #119 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Workqueue: events asyncpfexecute [kvm] RIP: 0010:kvmputkvm+0x2d/0x320 [kvm] Call Trace: asyncpfexecute+0x198/0x260 [kvm] processonework+0x145/0x2d0 workerthread+0x27e/0x3a0 kthread+0xba/0xe0 retfromfork+0x2d/0x50 retfromforkasm+0x11/0x20 ---[ end trace 0000000000000000 ]--- INFO: task kworker/8:1:251 blocked for more than 120 seconds. Tainted: G W 6.6.0-rc1-e7af8d17224a-x86/gmem-vm #119 "echo 0 > /proc/sys/kernel/hungtasktimeoutsecs" disables this message. task:kworker/8:1 state:D stack:0 pid:251 ppid:2 flags:0x00004000 Workqueue: events asyncpfexecute [kvm] Call Trace: schedule+0x33f/0xa40 schedule+0x53/0xc0 scheduletimeout+0x12a/0x140 waitforcommon+0x8d/0x1d0 flushwork.isra.0+0x19f/0x2c0 kvmclearasyncpfcompletionqueue+0x129/0x190 [kvm] kvmarchdestroyvm+0x78/0x1b0 [kvm] kvmputkvm+0x1c1/0x320 [kvm] asyncpfexecute+0x198/0x260 [kvm] processonework+0x145/0x2d0 workerthread+0x27e/0x3a0 kthread+0xba/0xe0 retfromfork+0x2d/0x50 retfromforkasm+0x11/0x20
If kvmclearasyncpfcompletionqueue() actually flushes the workqueue, then there's no need to gift asyncpfexecute() a reference because all invocations of asyncpfexecute() will be forced to complete before the vCPU and its VM are destroyed/freed. And that in turn fixes the module unloading bug as fput() won't do moduleput() on the last vCPU reference until the vCPU has been freed, e.g. if closing the vCPU file also puts the last reference to the KVM module.
Note that kvmcheckasyncpfcompletion() may also take the work item off the completion queue and so also needs to flush the work queue, as the work will not be seen by kvmclearasyncpfcompletionqueue(). Waiting on the workqueue could theoretically delay a vCPU due to waiting for the work to complete, but that's a very, very small chance, and likely a very small delay. kvmarchasyncpagepresentqueued() unconditionally makes a new request, i.e. will effectively delay entering the guest, so the remaining work is really just:
tracekvmasyncpfcompleted(addr, cr2orgpa);
kvmvcpuwakeup(vcpu);
mmput(mm);
and mmput() can't drop the last reference to the page tables if the vCPU is still alive, i.e. the vCPU won't get stuck tearing down page tables.
Add a helper to do the flushing, specifically to deal with "wakeup all" work items, as they aren't actually work items, i.e. are never placed in a workqueue. Trying to flush a bogus workqueue entry rightly makes flushwork() complain (kudos to whoever added that sanity check).
Note, commit 5f6de5cbebee ("KVM: Prevent module exit until al ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix failure to detect DAT corruption in btree and direct mappings
Patch series "nilfs2: fix kernel bug at submitbhwbc()".
This resolves a kernel BUG reported by syzbot. Since there are two flaws involved, I've made each one a separate patch.
The first patch alone resolves the syzbot-reported bug, but I think both fixes should be sent to stable, so I've tagged them as such.
This patch (of 2):
Syzbot has reported a kernel bug in submitbhwbc() when writing file data to a nilfs2 file system whose metadata is corrupted.
There are two flaws involved in this issue.
The first flaw is that when nilfsgetblock() locates a data block using btree or direct mapping, if the disk address translation routine nilfsdattranslate() fails with internal code -ENOENT due to DAT metadata corruption, it can be passed back to nilfsgetblock(). This causes nilfsgetblock() to misidentify an existing block as non-existent, causing both data block lookup and insertion to fail inconsistently.
The second flaw is that nilfsgetblock() returns a successful status in this inconsistent state. This causes the caller blockwritebeginint() or others to request a read even though the buffer is not mapped, resulting in a BUGON check for the BHMapped flag in submitbhwbc() failing.
This fixes the first issue by changing the return value to code -EINVAL when a conversion using DAT fails with code -ENOENT, avoiding the conflicting condition that leads to the kernel bug described above. Here, code -EINVAL indicates that metadata corruption was detected during the block lookup, which will be properly handled as a file system error and converted to -EIO when passing through the nilfs2 bmap layer.
In the Linux kernel, the following vulnerability has been resolved:
thermal: core: Fix thermal zone device registration error path
If thermalzonedeviceregisterwithtrips() fails after registering a thermal zone device, it needs to wait for the tz->removal completion like thermalzonedeviceunregister(), in case user space has managed to take a reference to the thermal zone device's kobject, in which case thermalrelease() may not be called by the error path itself and tz may be freed prematurely.
Add the missing waitforcompletion() call to the thermal zone device registration error path.
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix double-free in SMB2ioctl() replay
A response-bearing attempt can return a replayable error and free its response buffer. If SMB2ioctlinit() fails before the next send, cleanup retains the previous buffer type and frees that response again.
Reset response bookkeeping before each attempt to prevent the stale free.
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix change notify replay double-free
A response-bearing attempt can return a replayable error and free its response buffer. If SMB2notifyinit() fails before the next send, cleanup retains the previous buffer type and frees that response again.
Reset response bookkeeping before each attempt to prevent the stale free.
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix query directory replay double-free
A response-bearing attempt can return a replayable error and free its response buffer. If SMB2querydirectoryinit() fails before the next send, cleanup retains the previous buffer type and frees that response again.
Reset response bookkeeping before each attempt to prevent the stale free.
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix double-free in SMB2open() replay
A response-bearing attempt can return a replayable error and free its response buffer. If SMB2openinit() fails before the next send, cleanup retains the previous buffer type and frees that response again.
Reset response bookkeeping before each attempt to prevent the stale free.