In the Linux kernel, the following vulnerability has been resolved:
phy: qcom-qmp-combo: fix NULL-deref on runtime resume
Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCSUSB region") started treating the PCSUSB registers as potentially separate from the PCS registers but used the wrong base when no PCSUSB offset has been provided.
Fix the PCSUSB base used at runtime resume to prevent dereferencing a NULL pointer on platforms that do not provide a PCSUSB offset (e.g. SC7180).
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hcisysfs: Fix attempting to call deviceadd multiple times
deviceadd shall not be called multiple times as stated in its documentation:
'Do not call this routine or deviceregister() more than once for any device structure'
Syzkaller reports a bug as follows [1]: ------------[ cut here ]------------ kernel BUG at lib/listdebug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: <TASK> listadd include/linux/list.h:69 [inline] listaddtail include/linux/list.h:102 [inline] kobjksetjoin lib/kobject.c:164 [inline] kobjectaddinternal+0x18f/0x8f0 lib/kobject.c:214 kobjectaddvarg lib/kobject.c:358 [inline] kobjectadd+0x150/0x1c0 lib/kobject.c:410 deviceadd+0x368/0x1e90 drivers/base/core.c:3452 hciconnaddsysfs+0x9b/0x1b0 net/bluetooth/hcisysfs.c:53 hcilecisestabilishedevt+0x57c/0xae0 net/bluetooth/hcievent.c:6799 hcilemetaevt+0x2b8/0x510 net/bluetooth/hcievent.c:7110 hcieventfunc net/bluetooth/hcievent.c:7440 [inline] hcieventpacket+0x63d/0xfd0 net/bluetooth/hcievent.c:7495 hcirxwork+0xae7/0x1230 net/bluetooth/hcicore.c:4007 processonework+0x991/0x1610 kernel/workqueue.c:2289 workerthread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 retfromfork+0x1f/0x30 arch/x86/entry/entry64.S:306 </TASK>
In the Linux kernel, the following vulnerability has been resolved:
ext4: avoid crash when inline data creation follows DIO write
When inode is created and written to using direct IO, there is nothing to clear the EXT4STATEMAYINLINEDATA flag. Thus when inode gets truncated later to say 1 byte and written using normal write, we will try to store the data as inline data. This confuses the code later because the inode now has both normal block and inline data allocated and the confusion manifests for example as:
kernel BUG at fs/ext4/inode.c:2721! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 359 Comm: repro Not tainted 5.19.0-rc8-00001-g31ba1e3b8305-dirty #15 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014 RIP: 0010:ext4writepages+0x363d/0x3660 RSP: 0018:ffffc90000ccf260 EFLAGS: 00010293 RAX: ffffffff81e1abcd RBX: 0000008000000000 RCX: ffff88810842a180 RDX: 0000000000000000 RSI: 0000008000000000 RDI: 0000000000000000 RBP: ffffc90000ccf650 R08: ffffffff81e17d58 R09: ffffed10222c680b R10: dfffe910222c680c R11: 1ffff110222c680a R12: ffff888111634128 R13: ffffc90000ccf880 R14: 0000008410000000 R15: 0000000000000001 FS: 00007f72635d2640(0000) GS:ffff88811b000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000565243379180 CR3: 000000010aa74000 CR4: 0000000000150eb0 Call Trace: <TASK> dowritepages+0x397/0x640 filemapfdatawritewbc+0x151/0x1b0 filewriteandwaitrange+0x1c9/0x2b0 ext4syncfile+0x19e/0xa00 vfsfsyncrange+0x17b/0x190 ext4bufferedwriteiter+0x488/0x530 ext4filewriteiter+0x449/0x1b90 vfswrite+0xbcd/0xf40 ksyswrite+0x198/0x2c0 x64syswrite+0x7b/0x90 dosyscall64+0x3d/0x90 entrySYSCALL64afterhwframe+0x63/0xcd </TASK>
Fix the problem by clearing EXT4STATEMAYINLINEDATA when we are doing direct IO write to a file.
In the Linux kernel, the following vulnerability has been resolved:
memory: pl353-smc: Fix refcount leak bug in pl353smcprobe()
The break of foreachavailablechildofnode() needs a corresponding ofnodeput() when the reference 'child' is not used anymore. Here we do not need to call ofnodeput() in fail path as '!match' means no break.
While the ofplatformdevicecreate() will created a new reference by 'child' but it has considered the refcounting.
In the Linux kernel, the following vulnerability has been resolved:
perf/x86/amd/uncore: Fix memory leak for events array
When a CPU comes online, the per-CPU NB and LLC uncore contexts are freed but not the events array within the context structure. This causes a memory leak as identified by the kmemleak detector.
[...] unreferenced object 0xffff8c5944b8e320 (size 32): comm "swapper/0", pid 1, jiffies 4294670387 (age 151.072s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000000759fb79>] amduncorecpuupprepare+0xaf/0x230 [<00000000ddc9e126>] cpuhpinvokecallback+0x2cf/0x470 [<0000000093e727d4>] cpuhpissuecall+0x14d/0x170 [<0000000045464d54>] cpuhpsetupstatecpuslocked+0x11e/0x330 [<0000000069f67cbd>] cpuhpsetupstate+0x6b/0x110 [<0000000015365e0f>] amduncoreinit+0x260/0x321 [<00000000089152d2>] dooneinitcall+0x3f/0x1f0 [<000000002d0bd18d>] kernelinitfreeable+0x1ca/0x212 [<0000000030be8dde>] kernelinit+0x11/0x120 [<0000000059709e59>] retfromfork+0x22/0x30 unreferenced object 0xffff8c5944b8dd40 (size 64): comm "swapper/0", pid 1, jiffies 4294670387 (age 151.072s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000306efe8b>] amduncorecpuupprepare+0x183/0x230 [<00000000ddc9e126>] cpuhpinvokecallback+0x2cf/0x470 [<0000000093e727d4>] cpuhpissuecall+0x14d/0x170 [<0000000045464d54>] cpuhpsetupstatecpuslocked+0x11e/0x330 [<0000000069f67cbd>] cpuhpsetupstate+0x6b/0x110 [<0000000015365e0f>] amduncoreinit+0x260/0x321 [<00000000089152d2>] dooneinitcall+0x3f/0x1f0 [<000000002d0bd18d>] kernelinitfreeable+0x1ca/0x212 [<0000000030be8dde>] kernelinit+0x11/0x120 [<0000000059709e59>] retfromfork+0x22/0x30 [...]
Fix the problem by freeing the events array before freeing the uncore context.
In the Linux kernel, the following vulnerability has been resolved:
memory: of: Fix refcount leak bug in ofgetddrtimings()
We should add the ofnodeput() when breaking out of foreachchildofnode() as it will automatically increase and decrease the refcount.
In the Linux kernel, the following vulnerability has been resolved:
drivers: serial: jsm: fix some leaks in probe
This error path needs to unwind instead of just returning directly.
In the Linux kernel, the following vulnerability has been resolved:
iouring/msgring: Fix NULL pointer dereference in iomsgsendfd()
Syzkaller produced the below call trace:
BUG: KASAN: null-ptr-deref in iomsgring+0x3cb/0x9f0 Write of size 8 at addr 0000000000000070 by task repro/16399
CPU: 0 PID: 16399 Comm: repro Not tainted 6.1.0-rc1 #28 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 Call Trace: <TASK> dumpstacklvl+0xcd/0x134 ? iomsgring+0x3cb/0x9f0 kasanreport+0xbc/0xf0 ? iomsgring+0x3cb/0x9f0 kasancheckrange+0x140/0x190 iomsgring+0x3cb/0x9f0 ? iomsgringprep+0x300/0x300 ioissuesqe+0x698/0xca0 iosubmitsqes+0x92f/0x1c30 dosysiouringenter+0xae4/0x24b0 .... RIP: 0033:0x7f2eaf8f8289 RSP: 002b:00007fff40939718 EFLAGS: 00000246 ORIGRAX: 00000000000001aa RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f2eaf8f8289 RDX: 0000000000000000 RSI: 0000000000006f71 RDI: 0000000000000004 RBP: 00007fff409397a0 R08: 0000000000000000 R09: 0000000000000039 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004006d0 R13: 00007fff40939880 R14: 0000000000000000 R15: 0000000000000000 </TASK> Kernel panic - not syncing: paniconwarn set ...
We don't have a NULL check on fileptr in iomsgsendfd() function, so when fileptr is NUL srcfile is also NULL and getfile() dereferences a NULL pointer and leads to above crash.
Add a NULL check to fix this issue.
In the Linux kernel, the following vulnerability has been resolved:
erofs: fix order >= MAXORDER warning due to crafted negative isize
As syzbot reported [1], the root cause is that isize field is a signed type, and negative isize is also less than EROFSBLKSIZ. As a consequence, it's handled as fast symlink unexpectedly.
Let's fall back to the generic path to deal with such unusual isize.
[1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com
In the Linux kernel, the following vulnerability has been resolved:
drm/bridge: megachips: Fix a null pointer dereference bug
When removing the module we will get the following warning:
[ 31.911505] i2c-core: driver [stdp2690-ge-b850v3-fw] unregistered [ 31.912484] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI [ 31.913338] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] [ 31.915280] RIP: 0010:drmbridgeremove+0x97/0x130 [ 31.921825] Call Trace: [ 31.922533] stdp4028geb850v3fwremove+0x34/0x60 [megachipsstdpxxxxgeb850v3fw] [ 31.923139] i2cdeviceremove+0x181/0x1f0
The two bridges (stdp2690, stdp4028) do not probe at the same time, so the driver does not call geb850v3resgiter() when probing, causing the driver to try to remove the object that has not been initialized.
Fix this by checking whether both the bridges are probed.
In the Linux kernel, the following vulnerability has been resolved:
media: cx88: Fix a null-ptr-deref bug in bufferprepare()
When the driver calls cx88riscbuffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in bufferqueue().
The following log can reveal it:
[ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:bufferqueue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] enqueueindriver+0x141/0x360 [ 41.837262] vb2startstreaming+0x62/0x4a0 [ 41.838216] vb2corestreamon+0x1da/0x2c0 [ 41.838516] vb2initfileio+0x981/0xbc0 [ 41.839141] vb2performfileio+0xbf9/0x1120 [ 41.840072] vb2fopread+0x20e/0x400 [ 41.840346] v4l2read+0x215/0x290 [ 41.840603] vfsread+0x162/0x4c0
Fix this by checking the return value of cx88riscbuffer()
[hverkuil: fix coding style issues]
In the Linux kernel, the following vulnerability has been resolved:
usb: dwc3: core: fix some leaks in probe
The dwc3getproperties() function calls:
dwc->usbpsy = powersupplygetbyname(usbpsyname);
so there is some additional clean up required on these error paths.
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hciconn: Fix crash on hcicreatecissync
When attempting to connect multiple ISO sockets without using DEFERSETUP may result in the following crash:
BUG: KASAN: null-ptr-deref in hcicreatecissync+0x18b/0x2b0 Read of size 2 at addr 0000000000000036 by task kworker/u3:1/50
CPU: 0 PID: 50 Comm: kworker/u3:1 Not tainted 6.0.0-rc7-02243-gb84a13ff4eda #4373 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-1.fc36 04/01/2014 Workqueue: hci0 hcicmdsyncwork Call Trace: <TASK> dumpstacklvl+0x19/0x27 kasanreport+0xbc/0xf0 ? hcicreatecissync+0x18b/0x2b0 hcicreatecissync+0x18b/0x2b0 ? getlinkmode+0xd0/0xd0 ? wwmutexlockslowpath+0x10/0x10 ? mutexlock+0xe0/0xe0 ? getlinkmode+0xd0/0xd0 hcicmdsyncwork+0x111/0x190 processonework+0x427/0x650 workerthread+0x87/0x750 ? processonework+0x650/0x650 kthread+0x14e/0x180 ? kthreadexit+0x50/0x50 retfromfork+0x22/0x30 </TASK>
In the Linux kernel, the following vulnerability has been resolved:
memory: of: Fix refcount leak bug in oflpddr3getddrtimings()
We should add the ofnodeput() when breaking out of foreachchildofnode() as it will automatically increase and decrease the refcount.
In the Linux kernel, the following vulnerability has been resolved:
clk: tegra20: Fix refcount leak in tegra20clockinit
offindmatchingnode() returns a node pointer with refcount incremented, we should use ofnodeput() on it when not need anymore. Add missing ofnodeput() to avoid refcount leak.
In the Linux kernel, the following vulnerability has been resolved:
drm/mipi-dsi: Detach devices when removing the host
Whenever the MIPI-DSI host is unregistered, the code of mipidsihostunregister() loops over every device currently found on that bus and will unregister it.
However, it doesn't detach it from the bus first, which leads to all kind of resource leaks if the host wants to perform some clean up whenever a device is detached.
In the Linux kernel, the following vulnerability has been resolved:
bpf: Propagate error from htablockbucket() to userspace
In htabmaplookupanddeletebatch() if htablockbucket() returns -EBUSY, it will go to next bucket. Going to next bucket may not only skip the elements in current bucket silently, but also incur out-of-bound memory access or expose kernel memory to userspace if current bucketcnt is greater than bucketsize or zero.
Fixing it by stopping batch operation and returning -EBUSY when htablockbucket() fails, and the application can retry or skip the busy batch as needed.
In the Linux kernel, the following vulnerability has been resolved:
dmaengine: ti: k3-udma: Reset UDMACHANRT byte counters to prevent overflow
UDMACHANRTBCNTREG stores the real-time channel bytecount statistics. These registers are 32-bit hardware counters and the driver uses these counters to monitor the operational progress status for a channel, when transferring more than 4GB of data it was observed that these counters overflow and completion calculation of a operation gets affected and the transfer hangs indefinitely.
This commit adds changes to decrease the byte count for every complete transaction so that these registers never overflow and the proper byte count statistics is maintained for ongoing transaction by the RT counters.
Earlier uc->bcnt used to maintain a count of the completed bytes at driver side, since the RT counters maintain the statistics of current transaction now, the maintenance of uc->bcnt is not necessary.
In the Linux kernel, the following vulnerability has been resolved:
nfsd: Fix a memory leak in an error handling path
If this memdupuser() call fails, the memory allocated in a previous call a few lines above should be freed. Otherwise it leaks.
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix null-ptr-deref in ext4writeinfo
I caught a null-ptr-deref bug as follows: ================================================================== KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f] CPU: 1 PID: 1589 Comm: umount Not tainted 5.10.0-02219-dirty #339 RIP: 0010:ext4writeinfo+0x53/0x1b0 [...] Call Trace: dquotwritebackdquots+0x341/0x9a0 ext4syncfs+0x19e/0x800 syncfilesystem+0x83/0x100 syncfilesystem+0x89/0xf0 genericshutdownsuper+0x79/0x3e0 killblocksuper+0xa1/0x110 deactivatelockedsuper+0xac/0x130 deactivatesuper+0xb6/0xd0 cleanupmnt+0x289/0x400 cleanupmnt+0x16/0x20 taskworkrun+0x11c/0x1c0 exittousermodeprepare+0x203/0x210 syscallexittousermode+0x5b/0x3a0 dosyscall64+0x59/0x70 entrySYSCALL64afterhwframe+0x44/0xa9 ==================================================================
Above issue may happen as follows: ------------------------------------- exittousermodeprepare taskworkrun cleanupmnt cleanupmnt deactivatesuper deactivatelockedsuper killblocksuper genericshutdownsuper shrinkdcacheforumount dentry = sb->sroot sb->sroot = NULL <--- Here set NULL syncfilesystem syncfilesystem sb->sop->syncfs > ext4syncfs dquotwritebackdquots sb->dqop->writeinfo > ext4writeinfo ext4journalstart(dinode(sb->sroot), EXT4HTQUOTA, 2) dinode(sb->sroot) sroot->dinode <--- Null pointer dereference
To solve this problem, we use ext4journalstartsb directly to avoid sroot being used.
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci{ldisc,serdev}: check percpuinitrwsem() failure
syzbot is reporting NULL pointer dereference at hciuartttyclose() [1], for rcusyncenter() is called without rcusyncinit() due to hciuartttyopen() ignoring percpuinitrwsem() failure.
While we are at it, fix that hciuartregisterdevice() ignores percpuinitrwsem() failure and hciuartunregisterdevice() does not call percpufreerwsem().
In the Linux kernel, the following vulnerability has been resolved:
i2c: designware: Fix handling of real but unexpected device interrupts
Commit c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") caused a regression on certain Gigabyte motherboards for Intel Alder Lake-S where system crashes to NULL pointer dereference in i2cdwxfermsg() when system resumes from S3 sleep state ("deep").
I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made following notes:
- Issue happens when resuming from S3 but not when resuming from "s2idle" - PCI device 00:15.0 == i2cdesignware.0 is already in D0 state when system enters into pcipmresumenoirq() while all other i2cdesignware PCI devices are in D3. Devices were runtime suspended and in D3 prior entering into suspend - Interrupt comes after pcipmresumenoirq() when device interrupts are re-enabled - According to register dump the interrupt really comes from the i2cdesignware.0. Controller is enabled, I2C target address register points to a one detectable I2C device address 0x60 and the DWICRAWINTRSTAT register STARTDET, STOPDET, ACTIVITY and TXEMPTY bits are set indicating completed I2C transaction.
My guess is that the firmware uses this controller to communicate with an on-board I2C device during resume but does not disable the controller before giving control to an operating system.
I was told the UEFI update fixes this but never the less it revealed the driver is not ready to handle TXEMPTY (or RXFULL) interrupt when device is supposed to be idle and state variables are not set (especially the dev->msgs pointer which may point to NULL or stale old data).
Introduce a new software status flag STATUSACTIVE indicating when the controller is active in driver point of view. Now treat all interrupts that occur when is not set as unexpected and mask all interrupts from the controller.
In the Linux kernel, the following vulnerability has been resolved:
tty: serial: fsllpuart: disable dma rx/tx use flags in lpuartdmashutdown
lpuartdmashutdown tears down lpuart dma, but lpuartflushbuffer can still occur which in turn tries to access dma apis if lpuartdmatxuse flag is true. At this point since dma is torn down, these dma apis can abort. Set lpuartdmatxuse and the corresponding rx flag lpuartdmarxuse to false in lpuartdmashutdown so that dmas are not accessed after they are relinquished.
Otherwise, when try to kill btattach, kernel may panic. This patch may fix this issue. root@imx8ulpevk:~# btattach -B /dev/ttyLP2 -S 115200 ^C[ 90.182296] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 90.189806] Modules linked in: moal(O) mlan(O) [ 90.194258] CPU: 0 PID: 503 Comm: btattach Tainted: G O 5.15.32-06136-g34eecdf2f9e4 #37 [ 90.203554] Hardware name: NXP i.MX8ULP 9X9 EVK (DT) [ 90.208513] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 90.215470] pc : fsledma3disablerequest+0x8/0x60 [ 90.220358] lr : fsledma3terminateall+0x34/0x20c [ 90.225237] sp : ffff800013f0bac0 [ 90.228548] x29: ffff800013f0bac0 x28: 0000000000000001 x27: ffff000008404800 [ 90.235681] x26: ffff000008404960 x25: ffff000008404a08 x24: ffff000008404a00 [ 90.242813] x23: ffff000008404a60 x22: 0000000000000002 x21: 0000000000000000 [ 90.249946] x20: ffff800013f0baf8 x19: ffff00000559c800 x18: 0000000000000000 [ 90.257078] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 90.264211] x14: 0000000000000003 x13: 0000000000000000 x12: 0000000000000040 [ 90.271344] x11: ffff00000600c248 x10: ffff800013f0bb10 x9 : ffff000057bcb090 [ 90.278477] x8 : fffffc0000241a08 x7 : ffff00000534ee00 x6 : ffff000008404804 [ 90.285609] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff0000055b3480 [ 90.292742] x2 : ffff8000135c0000 x1 : ffff00000534ee00 x0 : ffff00000559c800 [ 90.299876] Call trace: [ 90.302321] fsledma3disablerequest+0x8/0x60 [ 90.306851] lpuartflushbuffer+0x40/0x160 [ 90.311037] uartflushbuffer+0x88/0x120 [ 90.315050] ttydriverflushbuffer+0x20/0x30 [ 90.319496] hciuartflush+0x44/0x90 [ 90.323162] +0x34/0x12c [ 90.327253] ttyldiscclose+0x38/0x70 [ 90.331005] ttyldiscrelease+0xa8/0x190 [ 90.335018] ttyreleasestruct+0x24/0x8c [ 90.339022] ttyrelease+0x3ec/0x4c0 [ 90.342593] fput+0x70/0x234 [ 90.345652] fput+0x14/0x20 [ 90.348790] taskworkrun+0x84/0x17c [ 90.352455] doexit+0x310/0x96c [ 90.355688] dogroupexit+0x3c/0xa0 [ 90.359259] arm64sysexitgroup+0x1c/0x20 [ 90.363609] invokesyscall+0x48/0x114 [ 90.367362] el0svccommon.constprop.0+0xd4/0xfc [ 90.372068] doel0svc+0x2c/0x94 [ 90.375379] el0svc+0x28/0x80 [ 90.378438] el0t64synchandler+0xa8/0x130 [ 90.382711] el0t64sync+0x1a0/0x1a4 [ 90.386376] Code: 17ffffda d503201f d503233f f9409802 (b9400041) [ 90.392467] ---[ end trace 2f60524b4a43f1f6 ]--- [ 90.397073] note: btattach[503] exited with preemptcount 1 [ 90.402636] Fixing recursive fault but reboot is needed!
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix race between quota enable and quota rescan ioctl
When enabling quotas, at btrfsquotaenable(), after committing the transaction, we change fsinfo->quotaroot to point to the quota root we created and set BTRFSFSQUOTAENABLED at fsinfo->flags. Then we try to start the qgroup rescan worker, first by initializing it with a call to qgrouprescaninit() - however if that fails we end up freeing the quota root but we leave fsinfo->quotaroot still pointing to it, this can later result in a use-after-free somewhere else.
We have previously set the flags BTRFSFSQUOTAENABLED and BTRFSQGROUPSTATUSFLAGON, so we can only fail with -EINPROGRESS at btrfsquotaenable(), which is possible if someone already called the quota rescan ioctl, and therefore started the rescan worker.
So fix this by ignoring an -EINPROGRESS and asserting we can't get any other error.
In the Linux kernel, the following vulnerability has been resolved:
fbdev: fbcon: release buffer when fbcondosetfont() failed
syzbot is reporting memory leak at fbcondosetfont() [1], for commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when vcresize() failed") missed that the buffer might be newly allocated by fbconsetfont().
In the Linux kernel, the following vulnerability has been resolved:
net: If sock is dead don't access sock's skwq in skstreamwaitmemory
Fixes the below NULL pointer dereference:
[...] [ 14.471200] Call Trace: [ 14.471562] <TASK> [ 14.471882] lockacquire+0x245/0x2e0 [ 14.472416] ? removewaitqueue+0x12/0x50 [ 14.473014] ? rawspinlockirqsave+0x17/0x50 [ 14.473681] rawspinlockirqsave+0x3d/0x50 [ 14.474318] ? removewaitqueue+0x12/0x50 [ 14.474907] removewaitqueue+0x12/0x50 [ 14.475480] skstreamwaitmemory+0x20d/0x340 [ 14.476127] ? dowaitintrirq+0x80/0x80 [ 14.476704] dotcpsendpages+0x287/0x600 [ 14.477283] tcpbpfpush+0xab/0x260 [ 14.477817] tcpbpfsendmsgredir+0x297/0x500 [ 14.478461] ? localbhenableip+0x77/0xe0 [ 14.479096] tcpbpfsendverdict+0x105/0x470 [ 14.479729] tcpbpfsendmsg+0x318/0x4f0 [ 14.480311] socksendmsg+0x2d/0x40 [ 14.480822] syssendmsg+0x1b4/0x1c0 [ 14.481390] ? copymsghdrfromuser+0x62/0x80 [ 14.482048] syssendmsg+0x78/0xb0 [ 14.482580] ? vmfinsertpfnprot+0x91/0x150 [ 14.483215] ? dofault+0x2a/0x1a0 [ 14.483738] ? dofault+0x15e/0x5d0 [ 14.484246] ? handlemmfault+0x56b/0x1040 [ 14.484874] ? lockisheldtype+0xdf/0x130 [ 14.485474] ? findheldlock+0x2d/0x90 [ 14.486046] ? syssendmsg+0x41/0x70 [ 14.486587] syssendmsg+0x41/0x70 [ 14.487105] ? intelpmudrainpebscore+0x350/0x350 [ 14.487822] dosyscall64+0x34/0x80 [ 14.488345] entrySYSCALL64afterhwframe+0x63/0xcd [...]
The test scenario has the following flow:
thread1 thread2 ----------- --------------- tcpbpfsendmsg tcpbpfsendverdict tcpbpfsendmsgredir sockclose tcpbpfpushlocked sockrelease tcpbpfpush //inetrelease dotcpsendpages sock->ops->release skstreamwaitmemory // tcpclose skwaitevent sk->skprot->close releasesock(sk); locksock(sk); tcpclose sockorphan(sk) sk->skwq = NULL releasesock locksock(sk); removewaitqueue(sksleep(sk), &wait); sksleep(sk) //NULL pointer dereference &rcudereferenceraw(sk->skwq)->wait
While waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcpbpfsendverdict didn't increase the fcount of psock->skredir->sksocket->file in thread1.
We should check if SOCKDEAD flag is set on wakeup in skstreamwaitmemory before accessing the wait queue.
In the Linux kernel, the following vulnerability has been resolved:
mm/uffd: fix warning without PTEMARKERUFFDWP compiled in
When PTEMARKERUFFDWP not configured, it's still possible to reach pte marker code and trigger an warning. Add a few CONFIGPTEMARKERUFFDWP ifdefs to make sure the code won't be reached when not compiled in.
In the Linux kernel, the following vulnerability has been resolved:
clk: tegra: Fix refcount leak in tegra210clockinit
offindmatchingnode() returns a node pointer with refcount incremented, we should use ofnodeput() on it when not need anymore. Add missing ofnodeput() to avoid refcount leak.
In the Linux kernel, the following vulnerability has been resolved:
scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFTID
An error case exit from lpfccmplctcmdgftid() results in a call to lpfcnlpput() with a null pointer to a nodelist structure.
Changed lpfccmplctcmdgftid() to initialize nodelist pointer upon entry.
In the Linux kernel, the following vulnerability has been resolved:
staging: rtl8723bs: fix potential memory leak in rtwinitdrvsw()
In rtwinitdrvsw(), there are various init functions are called to populate the padapter structure and some checks for their return value. However, except for the first one error path, the other five error paths do not properly release the previous allocated resources, which leads to various memory leaks.
This patch fixes them and keeps the success and error separate. Note that these changes keep the form of rtwinitdrvsw() in "drivers/staging/r8188eu/osdep/osintfs.c". As there is no proper device to test with, no runtime testing was performed.