In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: msft: Fix memory leak
Fix leaking buffer allocated to send MSFTOPLEMONITORADVERTISEMENT.
In the Linux kernel, the following vulnerability has been resolved:
powerpc/pseries: Fix potential memleak in paprgetattr()
buf is allocated in paprgetattr(), and krealloc() of buf could fail. We need to free the original buf in the case of failure.
In the Linux kernel, the following vulnerability has been resolved:
KVM: guestmemfd: Treat memslot binding offset+size as unsigned values
When binding a memslot to a guestmemfd file, treat the offset and size as unsigned values to fix a bug where the sum of the two can result in a false negative when checking for overflow against the size of the file. Passing unsigned values also avoids relying on somewhat obscure checks in other flows for safety, and tracks the offset and size as they are intended to be tracked, as unsigned values.
On 64-bit kernels, the number of pages a memslot contains and thus the size (and offset) of its guestmemfd binding are unsigned 64-bit values. Taking the offset+size as an lofft instead of a uofft inadvertently converts the unsigned value to a signed value if the offset and/or size is massive.
Locally storing the offset and size as signed values is benign in and of itself (though even that is extremely difficult to discern), but operating on their sum is not.
For the offset, KVM explicitly checks against a negative value, which might seem like a bug as KVM could incorrectly reject a legitimate binding, but that's not actually the case as KVMCREATEGUESTMEMFD takes a signed value for its size, i.e. a would-be-negative offset is also greater than the maximum possible size of any guestmemfd file.
Regarding the size, while KVM lacks an explicit check for a negative value, i.e. seemingly has a flawed overflow check, KVM restricts the number of pages in a single memslot to the largest positive signed 32-bit value:
if (id < KVMUSERMEMSLOTS && (mem->memorysize >> PAGESHIFT) > KVMMEMMAXNRPAGES) return -EINVAL;
and so that maximum "size" will ever be is 0x7fffffff000.
The sum of the two is, however, problematic. While the size is restricted by KVM's memslot logic, the offset is not, i.e. the offset is completely unchecked until the "offset + size > isizeread(inode)" check. If the offset is the (nearly) largest possible positive value, then adding size to the offset can result in a signed, negative 64-bit value. When compared against the size of the file (guaranteed to be positive), the negative sum is always smaller, and KVM incorrectly allows the absurd offset.
Opportunistically add missing includes in kvmmm.h (instead of relying on its parents).
In the Linux kernel, the following vulnerability has been resolved:
wifi: mt76: Fix memory leak destroying device
All MT76 rx queues have an associated pagepool even if the queue is not associated to a NAPI (e.g. WED RRO queues with WED enabled). Destroy the pagepool running mt76dmacleanup routine during module unload. Moreover returns pages to the page pool if WED is not enabled for WED RRO queues.
In the Linux kernel, the following vulnerability has been resolved:
drm/xe/display: fix oops in suspend/shutdown without display
The xe driver keeps track of whether to probe display, and whether display hardware is there, using xe->info.probedisplay. It gets set to false if there's no display after inteldisplaydeviceprobe(). However, the display may also be disabled via fuses, detected at a later time in inteldisplaydeviceinforuntimeinit().
In this case, the xe driver does foreachintelcrtc() on uninitialized mode config in xedisplayflushcleanupwork(), leading to a NULL pointer dereference, and generally calls display code with display info cleared.
Check for inteldisplaydevicepresent() after inteldisplaydeviceinforuntimeinit(), and reset xe->info.probedisplay as necessary. Also do unsetdisplayfeatures() for completeness, although display runtime init has already done that. This will need to be unified across all cases later.
Move inteldisplaydeviceinforuntimeinit() call slightly earlier, similar to i915, to avoid a bunch of unnecessary setup for no display cases.
Note #1: The xe driver has no business doing low level display plumbing like foreachintelcrtc() to begin with. It all needs to happen in display code.
Note #2: The actual bug is present already in commit 44e694958b95 ("drm/xe/display: Implement display support"), but the oops was likely introduced later at commit ddf6492e0e50 ("drm/xe/display: Make display suspend/resume work on discrete").
(cherry picked from commit 7c3eb9f47533220888a67266448185fd0775d4da)
In the Linux kernel, the following vulnerability has been resolved:
media: chips-media: wave5: Fix device cleanup order to prevent kernel panic
Move video device unregistration to the beginning of the remove function to ensure all video operations are stopped before cleaning up the worker thread and disabling PM runtime. This prevents hardware register access after the device has been powered down.
In polling mode, the hrtimer periodically triggers wave5vputimercallback() which queues work to the kthread worker. The worker executes wave5vpuirqworkfn() which reads hardware registers via wave5vdireadregister().
The original cleanup order disabled PM runtime and powered down hardware before unregistering video devices. When autosuspend triggers and powers off the hardware, the video devices are still registered and the worker thread can still be triggered by the hrtimer, causing it to attempt reading registers from powered-off hardware. This results in a bus error (synchronous external abort) and kernel panic.
This causes random kernel panics during encoding operations:
Internal error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP Modules linked in: wave5 rpmsgctrl rpmsgchar ... CPU: 0 UID: 0 PID: 1520 Comm: vpuirqthread Tainted: G M W pc : wave5vdireadregister+0x10/0x38 [wave5] lr : wave5vpuirqworkfn+0x28/0x60 [wave5] Call trace: wave5vdireadregister+0x10/0x38 [wave5] kthreadworkerfn+0xd8/0x238 kthread+0x104/0x120 retfromfork+0x10/0x20 Code: aa1e03e9 d503201f f9416800 8b214000 (b9400000) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: synchronous external abort: Fatal exception
In the Linux kernel, the following vulnerability has been resolved:
rxrpc, afs: Fix missing error pointer check after rxrpckernellookuppeer()
rxrpckernellookuppeer() can also return error pointers in addition to NULL, so just checking for NULL is not sufficient.
Fix this by:
(1) Changing rxrpckernellookuppeer() to return -ENOMEM rather than NULL on allocation failure.
(2) Making the callers in afs use ISERR() and PTRERR() to pass on the error code returned.
In the Linux kernel, the following vulnerability has been resolved:
media: chips-media: wave5: Fix PM runtime usage count underflow
Replace pmruntimeputsync() with pmruntimedontuseautosuspend() in the remove path to properly pair with pmruntimeuseautosuspend() from probe. This allows pmruntimedisable() to handle reference count cleanup correctly regardless of current suspend state.
The driver calls pmruntimeputsync() unconditionally in remove, but the device may already be suspended due to autosuspend configured in probe. When autosuspend has already suspended the device, the usage count is 0, and pmruntimeputsync() decrements it to -1.
This causes the following warning on module unload:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 963 at kernel/kthread.c:1430 kthreaddestroyworker+0x84/0x98 ... vdec 30210000.video-codec: Runtime PM usage count underflow!
In the Linux kernel, the following vulnerability has been resolved:
drm/xe: Fix taking invalid lock on wedge
If device wedges on e.g. GuC upload, the submission is not yet enabled and the state is not even initialized. Protect the wedge call so it does nothing in this case. It fixes the following splat:
[] xe 0000:bf:00.0: [drm] device wedged, needs recovery [] ------------[ cut here ]------------ [] DEBUGLOCKSWARNON(lock->magic != lock) [] WARNING: CPU: 48 PID: 312 at kernel/locking/mutex.c:564 mutexlock+0x8a1/0xe60 ... [] RIP: 0010:mutexlock+0x8a1/0xe60 [] mutexlocknested+0x1b/0x30 [] xegucsubmitwedge+0x80/0x2b0 [xe]
In the Linux kernel, the following vulnerability has been resolved:
mm: userfaultfd: fix race of userfaultfdmove and swap cache
This commit fixes two kinds of races, they may have different results:
Barry reported a BUGON in commit c50f8e6053b0, we may see the same BUGON if the filemap lookup returned NULL and folio is added to swap cache after that.
If another kind of race is triggered (folio changed after lookup) we may see RSS counter is corrupted:
[ 406.893936] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0 type:MMANONPAGES val:-1 [ 406.894071] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0 type:MMSHMEMPAGES val:1
Because the folio is being accounted to the wrong VMA.
I'm not sure if there will be any data corruption though, seems no. The issues above are critical already.
On seeing a swap entry PTE, userfaultfdmove does a lockless swap cache lookup, and tries to move the found folio to the faulting vma. Currently, it relies on checking the PTE value to ensure that the moved folio still belongs to the src swap entry and that no new folio has been added to the swap cache, which turns out to be unreliable.
While working and reviewing the swap table series with Barry, following existing races are observed and reproduced [1]:
In the example below, movepagespte is moving srcpte to dstpte, where srcpte is a swap entry PTE holding swap entry S1, and S1 is not in the swap cache:
CPU1 CPU2 userfaultfdmove movepagespte() entry = ptetoswpentry(origsrcpte); // Here it got entry = S1 ... < interrupted> ... <swapin srcpte, alloc and use folio A> // folio A is a new allocated folio // and get installed into srcpte <frees swap entry S1> // srcpte now points to folio A, S1 // has swap count == 0, it can be freed // by folioswapswap or swap // allocator's reclaim. <try to swap out another folio B> // folio B is a folio in another VMA. <put folio B to swap cache using S1 > // S1 is freed, folio B can use it // for swap out with no problem. ... folio = filemapgetfolio(S1) // Got folio B here !!! ... < interrupted again> ... <swapin folio B and free S1> // Now S1 is free to be used again. <swapout srcpte & folio A using S1> // Now srcpte is a swap entry PTE // holding S1 again. foliotrylock(folio) moveswappte doubleptlock isptepagesstable // Check passed because srcpte == S1 foliomoveanonrmap(...) // Moved invalid folio B here !!!
The race window is very short and requires multiple collisions of multiple rare events, so it's very unlikely to happen, but with a deliberately constructed reproducer and increased time window, it can be reproduced easily.
This can be fixed by checking if the folio returned by filemap is the valid swap cache folio after acquiring the folio lock.
Another similar race is possible: filemapgetfolio may return NULL, but folio (A) could be swapped in and then swapped out again using the same swap entry after the lookup. In such a case, folio (A) may remain in the swap cache, so it must be moved too:
CPU1 CPU2 userfaultfdmove movepagespte() entry = ptetoswpentry(origsrcpte); // Here it got entry = S1, and S1 is not in swap cache folio = filemapget ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
perf/dwcpcie: fix duplicate pcidev devices
During platformdeviceregister, wrongly using struct device pcidev as platformdata caused a kmemdup copy of pcidev. Worse still, accessing the duplicated device leads to list corruption as its mutex content (e.g., list, magic) remains the same as the original.
In the Linux kernel, the following vulnerability has been resolved:
drm/xe/vf: Don't try to trigger a full GT reset if VF
VFs don't have access to the GDRST(0x941c) register that driver uses to reset a GT. Attempt to trigger a reset using debugfs:
$ cat /sys/kernel/debug/dri/0000:00:02.1/gt0/forcereset
or due to a hang condition detected by the driver leads to:
[ ] xe 0000:00:02.1: [drm] GT0: trying reset from forcereset [xe] [ ] xe 0000:00:02.1: [drm] GT0: reset queued [ ] xe 0000:00:02.1: [drm] GT0: reset started [ ] ------------[ cut here ]------------ [ ] xe 0000:00:02.1: [drm] GT0: VF is trying to write 0x1 to an inaccessible register 0x941c+0x0 [ ] WARNING: CPU: 3 PID: 3069 at drivers/gpu/drm/xe/xegtsriovvf.c:996 xegtsriovvfwrite32+0xc6/0x580 [xe] [ ] RIP: 0010:xegtsriovvfwrite32+0xc6/0x580 [xe] [ ] Call Trace: [ ] <TASK> [ ] ? showregs+0x6c/0x80 [ ] ? warn+0x93/0x1c0 [ ] ? xegtsriovvfwrite32+0xc6/0x580 [xe] [ ] ? reportbug+0x182/0x1b0 [ ] ? handlebug+0x6e/0xb0 [ ] ? excinvalidop+0x18/0x80 [ ] ? asmexcinvalidop+0x1b/0x20 [ ] ? xegtsriovvfwrite32+0xc6/0x580 [xe] [ ] ? xegtsriovvfwrite32+0xc6/0x580 [xe] [ ] ? xegttlbinvalidationreset+0xef/0x110 [xe] [ ] ? mutexunlockslowpath+0x41/0x2e0 [ ] xemmiowrite32+0x64/0x150 [xe] [ ] dogtreset+0x2f/0xa0 [xe] [ ] gtresetworker+0x14e/0x1e0 [xe] [ ] processonework+0x21c/0x740 [ ] workerthread+0x1db/0x3c0
Fix that by sending H2G VFRESET(0x5507) action instead.
In the Linux kernel, the following vulnerability has been resolved:
mm: fix kernel BUG when userfaultfdmove encounters swapcache
userfaultfdmove() checks whether the PTE entry is present or a swap entry.
- If the PTE entry is present, movepresentpte() handles folio migration by setting:
srcfolio->index = linearpageindex(dstvma, dstaddr);
- If the PTE entry is a swap entry, moveswappte() simply copies the PTE to the new dstaddr.
This approach is incorrect because, even if the PTE is a swap entry, it can still reference a folio that remains in the swap cache.
This creates a race window between steps 2 and 4. 1. addtoswap: The folio is added to the swapcache. 2. trytounmap: PTEs are converted to swap entries. 3. pageout: The folio is written back. 4. Swapcache is cleared. If userfaultfdmove() occurs in the window between steps 2 and 4, after the swap PTE has been moved to the destination, accessing the destination triggers doswappage(), which may locate the folio in the swapcache. However, since the folio's index has not been updated to match the destination VMA, doswappage() will detect a mismatch.
This can result in two critical issues depending on the system configuration.
If KSM is disabled, both small and large folios can trigger a BUG during the addrmap operation due to:
pagepgoff(folio, page) != linearpageindex(vma, address)
[ 13.336953] page: refcount:6 mapcount:1 mapping:00000000f43db19c index:0xffffaf150 pfn:0x4667c [ 13.337520] head: order:2 mapcount:1 entiremapcount:0 nrpagesmapped:1 pincount:0 [ 13.337716] memcg:ffff00000405f000 [ 13.337849] anon flags: 0x3fffc0000020459(locked|uptodate|dirty|ownerpriv1|head|swapbacked|node=0|zone=0|lastcpupid=0xffff) [ 13.338630] raw: 03fffc0000020459 ffff80008507b538 ffff80008507b538 ffff000006260361 [ 13.338831] raw: 0000000ffffaf150 0000000000004000 0000000600000000 ffff00000405f000 [ 13.339031] head: 03fffc0000020459 ffff80008507b538 ffff80008507b538 ffff000006260361 [ 13.339204] head: 0000000ffffaf150 0000000000004000 0000000600000000 ffff00000405f000 [ 13.339375] head: 03fffc0000000202 fffffdffc0199f01 ffffffff00000000 0000000000000001 [ 13.339546] head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000 [ 13.339736] page dumped because: VMBUGONPAGE(pagepgoff(folio, page) != linearpageindex(vma, address)) [ 13.340190] ------------[ cut here ]------------ [ 13.340316] kernel BUG at mm/rmap.c:1380! [ 13.340683] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP [ 13.340969] Modules linked in: [ 13.341257] CPU: 1 UID: 0 PID: 107 Comm: a.out Not tainted 6.14.0-rc3-gcf42737e247a-dirty #299 [ 13.341470] Hardware name: linux,dummy-virt (DT) [ 13.341671] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 13.341815] pc : pagecheckanonrmap+0xa0/0xb0 [ 13.341920] lr : pagecheckanonrmap+0xa0/0xb0 [ 13.342018] sp : ffff80008752bb20 [ 13.342093] x29: ffff80008752bb20 x28: fffffdffc0199f00 x27: 0000000000000001 [ 13.342404] x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000001 [ 13.342575] x23: 0000ffffaf0d0000 x22: 0000ffffaf0d0000 x21: fffffdffc0199f00 [ 13.342731] x20: fffffdffc0199f00 x19: ffff000006210700 x18: 00000000ffffffff [ 13.342881] x17: 6c203d2120296567 x16: 6170202c6f696c6f x15: 662866666f67705f [ 13.343033] x14: 6567617028454741 x13: 2929737365726464 x12: ffff800083728ab0 [ 13.343183] x11: ffff800082996bf8 x10: 0000000000000fd7 x9 : ffff80008011bc40 [ 13.343351] x8 : 0000000000017fe8 x7 : 00000000fffff000 x6 : ffff8000829eebf8 [ 13.343498] x5 : c0000000fffff000 x4 : 0000000000000000 x3 : 0000000000000000 [ 13.343645] x2 : 0000000000000000 x1 : ffff0000062db980 x0 : 000000000000005f [ 13.343876] Call trace: [ 13.344045] pagecheckanonrmap+0xa0/0xb0 (P) [ 13.344234] folioaddanonrmapptes+0x22c/0x320 [ 13.344333] doswappage+0x1060/0x1400 [ 13.344417] handl ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
netfs: Call invalidatecache only if implemented
Many filesystems such as NFS and Ceph do not implement the invalidatecache method. On those filesystems, if writing to the cache (NETFSWRITETOCACHE) fails for some reason, the kernel crashes like this:
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor instruction fetch in kernel mode #PF: errorcode(0x0010) - not-present page PGD 0 P4D 0 Oops: Oops: 0010 [#1] SMP PTI CPU: 9 UID: 0 PID: 3380 Comm: kworker/u193:11 Not tainted 6.13.3-cm4all1-hp #437 Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 10/17/2018 Workqueue: eventsunbound netfswritecollectionworker RIP: 0010:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0018:ffff9b86e2ca7dc0 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 7fffffffffffffff RDX: 0000000000000001 RSI: ffff89259d576a18 RDI: ffff89259d576900 RBP: ffff89259d5769b0 R08: ffff9b86e2ca7d28 R09: 0000000000000002 R10: ffff89258ceaca80 R11: 0000000000000001 R12: 0000000000000020 R13: ffff893d158b9338 R14: ffff89259d576900 R15: ffff89259d5769b0 FS: 0000000000000000(0000) GS:ffff893c9fa40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 000000054442e003 CR4: 00000000001706f0 Call Trace: <TASK> ? die+0x1f/0x60 ? pagefaultoops+0x15c/0x460 ? trytowakeup+0x2d2/0x530 ? excpagefault+0x5e/0x100 ? asmexcpagefault+0x22/0x30 netfswritecollectionworker+0xe9f/0x12b0 ? xspollcheckreadable+0x3f/0x80 ? xsstreamdatareceiveworkfn+0x8d/0x110 processonework+0x134/0x2d0 workerthread+0x299/0x3a0 ? pfxworkerthread+0x10/0x10 kthread+0xba/0xe0 ? pfxkthread+0x10/0x10 retfromfork+0x30/0x50 ? pfxkthread+0x10/0x10 retfromforkasm+0x1a/0x30 </TASK> Modules linked in: CR2: 0000000000000000
This patch adds the missing NULL check.
In the Linux kernel, the following vulnerability has been resolved:
drm/xe: Use reserved copy engine for user binds on faulting devices
User binds map to engines with can fault, faults depend on user binds completion, thus we can deadlock. Avoid this by using reserved copy engine for user binds on faulting devices.
While we are here, normalize bind queue creation with a helper.
v2: - Pass in extensions to bind queue creation (CI) v3: - s/resevered/reserved (Lucas) - Fix NULL hwe check (Jonathan)
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpudmfini()
block: Fix page refcounts for unaligned buffers in bioreleasepages()
In the Linux kernel, the following vulnerability has been resolved:
x86/efistub: Call mixed mode boot services on the firmware's stack
Normally, the EFI stub calls into the EFI boot services using the stack that was live when the stub was entered. According to the UEFI spec, this stack needs to be at least 128k in size - this might seem large but all asynchronous processing and event handling in EFI runs from the same stack and so quite a lot of space may be used in practice.
In mixed mode, the situation is a bit different: the bootloader calls the 32-bit EFI stub entry point, which calls the decompressor's 32-bit entry point, where the boot stack is set up, using a fixed allocation of 16k. This stack is still in use when the EFI stub is started in 64-bit mode, and so all calls back into the EFI firmware will be using the decompressor's limited boot stack.
Due to the placement of the boot stack right after the boot heap, any stack overruns have gone unnoticed. However, commit
5c4feadb0011983b ("x86/decompressor: Move global symbol references to C code")
moved the definition of the boot heap into C code, and now the boot stack is placed right at the base of BSS, where any overruns will corrupt the end of the .data section.
While it would be possible to work around this by increasing the size of the boot stack, doing so would affect all x86 systems, and mixed mode systems are a tiny (and shrinking) fraction of the x86 installed base.
So instead, record the firmware stack pointer value when entering from the 32-bit firmware, and switch to this stack every time a EFI boot service call is made.
dm-raid: really frozen syncthread during suspend
drm/amd/display: Prevent crash when disable stream
In the Linux kernel, the following vulnerability has been resolved:
net: esp: fix bad handling of pages from pagepool
The Linux kernel CVE team has assigned CVE-2024-26953 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024050128-CVE-2024-26953-8304@gregkh/T
In the Linux kernel, the following vulnerability has been resolved:
nbd: null check for nlaneststart
nlaneststart() may fail and return NULL. Insert a check and set errno based on other call sites within the same source code.
In the Linux kernel, the following vulnerability has been resolved:
drm/xe/vf: Perform early GT MMIO initialization to read GMDID
VFs need to communicate with the GuC to obtain the GMDID value and existing GuC functions used for that assume that the GT has it's MMIO members already setup. However, due to recent refactoring the gt->mmio is initialized later, and any attempt by the VF to use xemmioread|write() from GuC functions will lead to NPD crash due to unset MMIO register address:
[] xe 0000:00:02.1: [drm] Running in SR-IOV VF mode [] xe 0000:00:02.1: [drm] GT0: sending H2G MMIO 0x5507 [] BUG: unable to handle page fault for address: 0000000000190240
Since we are already tweaking the id and type of the primary GT to mimic it's a Media GT before initializing the GuC communication, we can also call xegtmmioinit() to perform early setup of the gt->mmio which will make those GuC functions work again.
In the Linux kernel, the following vulnerability has been resolved:
spi: lpspi: Avoid potential use-after-free in probe()
fsllpspiprobe() is allocating/disposing memory manually with spiallochost()/spialloctarget(), but uses devmspiregistercontroller(). In case of error after the latter call the memory will be explicitly freed in the probe function by spicontrollerput() call, but used afterwards by "devm" management outside probe() (spiunregistercontroller() <- devmspiunregister() below).
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070 ... Call trace: kernfsfindns kernfsfindandgetns sysfsremovegroup sysfsremovegroups deviceremoveattrs devicedel spiunregistercontroller devmspiunregister releasenodes devresreleaseall reallyprobe driverprobedevice deviceattachdriver busforeachdrv deviceattach deviceinitialprobe busprobedevice deferredprobeworkfunc processonework workerthread kthread retfromfork
drm/bridge: adv7511: fix crash on irq during probe
In the Linux kernel, the following vulnerability has been resolved:
SUNRPC: fix a memleak in gssimportv2context
The ctx->mechused.data allocated by kmemdup is not freed in neither gssimportv2context nor it only caller gsskrb5importseccontext, which frees ctx on error.
Thus, this patch reform the last call of gssimportv2context to the gsskrb5importctxv2, preventing the memleak while keepping the return formation.
In the Linux kernel, the following vulnerability has been resolved:
drm/xe: always keep track of remap prev/next
During 3D workload, user is reporting hitting:
[ 413.361679] WARNING: drivers/gpu/drm/xe/xevm.c:1217 at vmbindioctlopsunwind+0x1e2/0x2e0 [xe], CPU#7: vkd3dqueue/9925 [ 413.361944] CPU: 7 UID: 1000 PID: 9925 Comm: vkd3dqueue Kdump: loaded Not tainted 7.0.0-070000rc3-generic #202603090038 PREEMPT(lazy) [ 413.361949] RIP: 0010:vmbindioctlopsunwind+0x1e2/0x2e0 [xe] [ 413.362074] RSP: 0018:ffffd4c25c3df930 EFLAGS: 00010282 [ 413.362077] RAX: 0000000000000000 RBX: ffff8f3ee817ed10 RCX: 0000000000000000 [ 413.362078] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 413.362079] RBP: ffffd4c25c3df980 R08: 0000000000000000 R09: 0000000000000000 [ 413.362081] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8f41fbf99380 [ 413.362082] R13: ffff8f3ee817e968 R14: 00000000ffffffef R15: ffff8f43d00bd380 [ 413.362083] FS: 00000001040ff6c0(0000) GS:ffff8f4696d89000(0000) knlGS:00000000330b0000 [ 413.362085] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 [ 413.362086] CR2: 00007ddfc4747000 CR3: 00000002e6262005 CR4: 0000000000f72ef0 [ 413.362088] PKRU: 55555554 [ 413.362089] Call Trace: [ 413.362092] <TASK> [ 413.362096] xevmbindioctl+0xa9a/0xc60 [xe]
Which seems to hint that the vma we are re-inserting for the ops unwind is either invalid or overlapping with something already inserted in the vm. It shouldn't be invalid since this is a re-insertion, so must have worked before. Leaving the likely culprit as something already placed where we want to insert the vma.
Following from that, for the case where we do something like a rebind in the middle of a vma, and one or both mapped ends are already compatible, we skip doing the rebind of those vma and set next/prev to NULL. As well as then adjust the original unmap va range, to avoid unmapping the ends. However, if we trigger the unwind path, we end up with three va, with the two ends never being removed and the original va range in the middle still being the shrunken size.
If this occurs, one failure mode is when another unwind op needs to interact with that range, which can happen with a vector of binds. For example, if we need to re-insert something in place of the original va. In this case the va is still the shrunken version, so when removing it and then doing a re-insert it can overlap with the ends, which were never removed, triggering a warning like above, plus leaving the vm in a bad state.
With that, we need two things here:
1) Stop nuking the prev/next tracking for the skip cases. Instead relying on checking for skip prev/next, where needed. That way on the unwind path, we now correctly remove both ends.
2) Undo the unmap va shrinkage, on the unwind path. With the two ends now removed the unmap va should expand back to the original size again, before re-insertion.
v2: - Update the explanation in the commit message, based on an actual IGT of triggering this issue, rather than conjecture. - Also undo the unmap shrinkage, for the skip case. With the two ends now removed, the original unmap va range should expand back to the original range. v3: - Track the old start/range separately. vmasize/start() uses the va info directly.
(cherry picked from commit aec6969f75afbf4e01fd5fb5850ed3e9c27043ac)
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nftables: reject immediate NFQUEUE verdict
nftqueue is always used from userspace nftables to deliver the NFQUEUE verdict. Immediately emitting an NFQUEUE verdict is never used by the userspace nft tools, so reject immediate NFQUEUE verdicts.
The arp family does not provide queue support, but such an immediate verdict is still reachable. Globally reject NFQUEUE immediate verdicts to address this issue.
In the Linux kernel, the following vulnerability has been resolved:
quota: Fix potential NULL pointer dereference
Below race may cause NULL pointer dereference
P1 P2 dquotfreeinode quotaoff dropdquotref removedquotref dquots = idquot(inode) dquots = idquot(inode) srcureadlock dquots[cnt]) != NULL (1) dquots[type] = NULL (2) spinlock(&dquots[cnt]->dqdqblock) (3) ....
If dquotfreeinode(or other routines) checks inode's quota pointers (1) before quotaoff sets it to NULL(2) and use it (3) after that, NULL pointer dereference will be triggered.
So let's fix it by using a temporary pointer to avoid this issue.
In the Linux kernel, the following vulnerability has been resolved:
drm/mediatek: Fix a null pointer crash in mtkdrmcrtcfinishpageflip
It's possible that mtkcrtc->event is NULL in mtkdrmcrtcfinishpageflip().
pendingneedsvblank value is set by mtkcrtc->event, but in mtkdrmcrtcatomicflush(), it's is not guarded by the same lock in mtkdrmfinishpageflip(), thus a race condition happens.
Consider the following case:
CPU1 CPU2 step 1: mtkdrmcrtcatomicbegin() mtkcrtc->event is not null, step 1: mtkdrmcrtcatomicflush: mtkdrmcrtcupdateconfig( !!mtkcrtc->event) step 2: mtkcrtcddpirq -> mtkdrmfinishpageflip: lock mtkcrtc->event set to null, pendingneedsvblank set to false unlock pendingneedsvblank set to true,
step 2: mtkcrtcddpirq -> mtkdrmfinishpageflip called again, pendingneedsvblank is still true //null pointer
Instead of guarding the entire mtkdrmcrtcatomicflush(), it's more efficient to just check if mtkcrtc->event is null before use.