In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hcisync: Fix UAF in hcidisconnectallsync
Use-after-free can occur in hcidisconnectallsync if a connection is deleted by concurrent processing of a controller event.
To prevent this the code now tries to iterate over the list backwards to ensure the links are cleanup before its parents, also it no longer relies on a cursor, instead it always uses the last element since hciabortconnsync is guaranteed to call hciconndel.
UAF crash log: ================================================================== BUG: KASAN: slab-use-after-free in hcisetpoweredsync (net/bluetooth/hcisync.c:5424) [bluetooth] Read of size 8 at addr ffff888009d9c000 by task kworker/u9:0/124
CPU: 0 PID: 124 Comm: kworker/u9:0 Tainted: G W 6.5.0-rc1+ #10 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 Workqueue: hci0 hcicmdsyncwork [bluetooth] Call Trace: <TASK> dumpstacklvl+0x5b/0x90 printreport+0xcf/0x670 ? virtaddrvalid+0xdd/0x160 ? hcisetpoweredsync+0x2c9/0x4a0 [bluetooth] kasanreport+0xa6/0xe0 ? hcisetpoweredsync+0x2c9/0x4a0 [bluetooth] ? pfxsetpoweredsync+0x10/0x10 [bluetooth] hcisetpoweredsync+0x2c9/0x4a0 [bluetooth] ? pfxhcisetpoweredsync+0x10/0x10 [bluetooth] ? pfxlockrelease+0x10/0x10 ? pfxsetpoweredsync+0x10/0x10 [bluetooth] hcicmdsyncwork+0x137/0x220 [bluetooth] processonework+0x526/0x9d0 ? pfxprocessonework+0x10/0x10 ? pfxdorawspinlock+0x10/0x10 ? markheldlocks+0x1a/0x90 workerthread+0x92/0x630 ? pfxworkerthread+0x10/0x10 kthread+0x196/0x1e0 ? pfxkthread+0x10/0x10 retfromfork+0x2c/0x50 </TASK>
Allocated by task 1782: kasansavestack+0x33/0x60 kasansettrack+0x25/0x30 kasankmalloc+0x8f/0xa0 hciconnadd+0xa5/0xa80 [bluetooth] hcibindcis+0x881/0x9b0 [bluetooth] isoconnectcis+0x121/0x520 [bluetooth] isosockconnect+0x3f6/0x790 [bluetooth] sysconnect+0x109/0x130 x64sysconnect+0x40/0x50 dosyscall64+0x60/0x90 entrySYSCALL64afterhwframe+0x6e/0xd8
Freed by task 695: kasansavestack+0x33/0x60 kasansettrack+0x25/0x30 kasansavefreeinfo+0x2b/0x50 kasanslabfree+0x10a/0x180 kmemcachefree+0x14d/0x2e0 devicerelease+0x5d/0xf0 kobjectput+0xdf/0x270 hcidisconncompleteevt+0x274/0x3a0 [bluetooth] hcieventpacket+0x579/0x7e0 [bluetooth] hcirxwork+0x287/0xaa0 [bluetooth] processonework+0x526/0x9d0 workerthread+0x92/0x630 kthread+0x196/0x1e0 retfromfork+0x2c/0x50 ==================================================================
In the Linux kernel, the following vulnerability has been resolved:
OPP: add index check to assert to avoid buffer overflow in readfreq()
Pass the freq index to the assert function to make sure we do not read a freq out of the opp->rates[] table when called from the indexed variants: devpmoppfindfreqexactindexed() or devpmoppfindfreqceil/floorindexed().
Add a secondary parameter to the assert function, unused for assertsingleclk() then add assertclkindex() which will check for the clock index when called from the indexed() find functions.
In the Linux kernel, the following vulnerability has been resolved:
HID: multitouch: fix slab out-of-bounds access in mtreportfixup()
A malicious HID device can trigger a slab out-of-bounds during mtreportfixup() by passing in report descriptor smaller than 607 bytes. mtreportfixup() attempts to patch byte offset 607 of the descriptor with 0x25 by first checking if byte offset 607 is 0x15 however it lacks bounds checks to verify if the descriptor is big enough before conducting this check. Fix this bug by ensuring the descriptor size is at least 608 bytes before accessing it.
Below is the KASAN splat after the out of bounds access happens:
[ 13.671954] ================================================================== [ 13.672667] BUG: KASAN: slab-out-of-bounds in mtreportfixup+0x103/0x110 [ 13.673297] Read of size 1 at addr ffff888103df39df by task kworker/0:1/10 [ 13.673297] [ 13.673297] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.15.0-00005-gec5d573d83f4-dirty #3 [ 13.673297] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/04 [ 13.673297] Call Trace: [ 13.673297] <TASK> [ 13.673297] dumpstacklvl+0x5f/0x80 [ 13.673297] printreport+0xd1/0x660 [ 13.673297] kasanreport+0xe5/0x120 [ 13.673297] asanreportload1noabort+0x18/0x20 [ 13.673297] mtreportfixup+0x103/0x110 [ 13.673297] hidopenreport+0x1ef/0x810 [ 13.673297] mtprobe+0x422/0x960 [ 13.673297] hiddeviceprobe+0x2e2/0x6f0 [ 13.673297] reallyprobe+0x1c6/0x6b0 [ 13.673297] driverprobedevice+0x24f/0x310 [ 13.673297] driverprobedevice+0x4e/0x220 [ 13.673297] deviceattachdriver+0x169/0x320 [ 13.673297] busforeachdrv+0x11d/0x1b0 [ 13.673297] deviceattach+0x1b8/0x3e0 [ 13.673297] deviceinitialprobe+0x12/0x20 [ 13.673297] busprobedevice+0x13d/0x180 [ 13.673297] deviceadd+0xe3a/0x1670 [ 13.673297] hidadddevice+0x31d/0xa40 [...]
In the Linux kernel, the following vulnerability has been resolved:
ASoC: Intel: bytcrrt5640: Fix invalid quirk input mapping
When an invalid value is passed via quirk option, currently bytcrrt5640 driver only shows an error message but leaves as is. This may lead to unepxected results like OOB access.
This patch corrects the input mapping to the certain default value if an invalid value is passed.
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:
blk-mq: fix possible memleak when register 'hctx' failed
There's issue as follows when do fault injection test: unreferenced object 0xffff888132a9f400 (size 512): comm "insmod", pid 308021, jiffies 4324277909 (age 509.733s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 08 f4 a9 32 81 88 ff ff ...........2.... 08 f4 a9 32 81 88 ff ff 00 00 00 00 00 00 00 00 ...2............ backtrace: [<00000000e8952bb4>] kmallocnodetrace+0x22/0xa0 [<00000000f9980e0f>] blkmqallocandinithctx+0x3f1/0x7e0 [<000000002e719efa>] blkmqreallochwctxs+0x1e6/0x230 [<000000004f1fda40>] blkmqinitallocatedqueue+0x27e/0x910 [<00000000287123ec>] blkmqallocdisk+0x67/0xf0 [<00000000a2a34657>] 0xffffffffa2ad310f [<00000000b173f718>] 0xffffffffa2af824a [<0000000095a1dabb>] dooneinitcall+0x87/0x2a0 [<00000000f32fdf93>] doinitmodule+0xdf/0x320 [<00000000cbe8541e>] loadmodule+0x3006/0x3390 [<0000000069ed1bdb>] dosysfinitmodule+0x113/0x1b0 [<00000000a1a29ae8>] dosyscall64+0x35/0x80 [<000000009cd878b0>] entrySYSCALL64afterhwframe+0x46/0xb0
Fault injection context as follows: kobjectadd blkmqregisterhctx blkmqsysfsregister blkregisterqueue deviceadddisk nulladddev.part.0 [nullblk]
As 'blkmqregisterhctx' may already add some objects when failed halfway, but there isn't do fallback, caller don't know which objects add failed. To solve above issue just do fallback when add objects failed halfway in 'blkmqregisterhctx'.
In the Linux kernel, the following vulnerability has been resolved:
RDMA/siw: Fix immediate work request flush to completion queue
Correctly set send queue element opcode during immediate work request flushing in post sendqueue operation, if the QP is in ERROR state. An undefined ocode value results in out-of-bounds access to an array for mapping the opcode between siw internal and RDMA core representation in work completion generation. It resulted in a KASAN BUG report of type 'global-out-of-bounds' during NFSoRDMA testing.
This patch further fixes a potential case of a malicious user which may write undefined values for completion queue elements status or opcode, if the CQ is memory mapped to user land. It avoids the same out-of-bounds access to arrays for status and opcode mapping as described above.
In the Linux kernel, the following vulnerability has been resolved:
fs: dlm: fix invalid derefence of sblvbptr
I experience issues when putting a lkbsb on the stack and have sblvbptr field to a dangled pointer while not using DLMLKFVALBLK. It will crash with the following kernel message, the dangled pointer is here 0xdeadbeef as example:
[ 102.749317] BUG: unable to handle page fault for address: 00000000deadbeef [ 102.749320] #PF: supervisor read access in kernel mode [ 102.749323] #PF: errorcode(0x0000) - not-present page [ 102.749325] PGD 0 P4D 0 [ 102.749332] Oops: 0000 [#1] PREEMPT SMP PTI [ 102.749336] CPU: 0 PID: 1567 Comm: locktorturewr Tainted: G W 5.19.0-rc3+ #1565 [ 102.749343] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 102.749344] RIP: 0010:memcpyerms+0x6/0x10 [ 102.749353] Code: cc cc cc cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe [ 102.749355] RSP: 0018:ffff97a58145fd08 EFLAGS: 00010202 [ 102.749358] RAX: ffff901778b77070 RBX: 0000000000000000 RCX: 0000000000000040 [ 102.749360] RDX: 0000000000000040 RSI: 00000000deadbeef RDI: ffff901778b77070 [ 102.749362] RBP: ffff97a58145fd10 R08: ffff901760b67a70 R09: 0000000000000001 [ 102.749364] R10: ffff9017008e2cb8 R11: 0000000000000001 R12: ffff901760b67a70 [ 102.749366] R13: ffff901760b78f00 R14: 0000000000000003 R15: 0000000000000001 [ 102.749368] FS: 0000000000000000(0000) GS:ffff901876e00000(0000) knlGS:0000000000000000 [ 102.749372] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.749374] CR2: 00000000deadbeef CR3: 000000017c49a004 CR4: 0000000000770ef0 [ 102.749376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 102.749378] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 102.749379] PKRU: 55555554 [ 102.749381] Call Trace: [ 102.749382] <TASK> [ 102.749383] ? sendargs+0xb2/0xd0 [ 102.749389] sendcommon+0xb7/0xd0 [ 102.749395] unlocklock+0x2c/0x90 [ 102.749400] unlocklock.isra.56+0x62/0xa0 [ 102.749405] dlmunlock+0x21e/0x330 [ 102.749411] ? locktorturestats+0x80/0x80 [dlmlocktorture] [ 102.749416] tortureunlock+0x5a/0x90 [dlmlocktorture] [ 102.749419] ? preemptcountsub+0xba/0x100 [ 102.749427] locktorturewriter+0xbd/0x150 [dlmlocktorture] [ 102.786186] kthread+0x10a/0x130 [ 102.786581] ? kthreadcompleteandexit+0x20/0x20 [ 102.787156] retfromfork+0x22/0x30 [ 102.787588] </TASK> [ 102.787855] Modules linked in: dlmlocktorture torture rpcsecgsskrb5 intelraplmsr intelraplcommon kvmintel iTCOwdt iTCOvendorsupport kvm vmwvsockvirtiotransport qxl irqbypass vmwvsockvirtiotransportcommon drmttmhelper crc32pclmul joydev crc32cintel ttm vsock virtioscsi virtioballoon sndpcm drmkmshelper virtioconsole sndtimer snd drm soundcore syscopyarea i2ci801 sysfillrect sysimgblt i2csmbus pcspkr fbsysfops lpcich serioraw [ 102.792536] CR2: 00000000deadbeef [ 102.792930] ---[ end trace 0000000000000000 ]---
This patch fixes the issue by checking also on DLMLKFVALBLK on exflags is set when copying the lvbptr array instead of if it's just null which fixes for me the issue.
I think this patch can fix other dlm users as well, depending how they handle the init, freeing memory handling of sblvbptr and don't set DLMLKFVALBLK for some dlmlock() calls. It might a there could be a hidden issue all the time. However with checking on DLMLKFVALBLK the user always need to provide a sblvbptr non-null value. There might be more intelligent handling between per ls lvblen, DLMLKFVALBLK and non-null to report the user the way how DLM API is used is wrong but can be added for later, this will only fix the current behaviour.
In the Linux kernel, the following vulnerability has been resolved:
media: camss: Clean up received buffers on failed start of streaming
It is required to return the received buffers, if streaming can not be started. For instance mediapipelinestart() may fail with EPIPE, if a link validation between entities is not passed, and in such a case a user gets a kernel warning:
WARNING: CPU: 1 PID: 520 at drivers/media/common/videobuf2/videobuf2-core.c:1592 vb2startstreaming+0xec/0x160 <snip> Call trace: vb2startstreaming+0xec/0x160 vb2corestreamon+0x9c/0x1a0 vb2ioctlstreamon+0x68/0xbc v4lstreamon+0x30/0x3c videodoioctl+0x184/0x3e0 videousercopy+0x37c/0x7b0 videoioctl2+0x24/0x40 v4l2ioctl+0x4c/0x70
The fix is to correct the error path in videostartstreaming() of camss.
In the Linux kernel, the following vulnerability has been resolved:
fs/ntfs3: Avoid UBSAN error on truesectorsperclst()
syzbot reported UBSAN error as below:
[ 76.901829][ T6677] ================================================================================ [ 76.903908][ T6677] UBSAN: shift-out-of-bounds in fs/ntfs3/super.c:675:13 [ 76.905363][ T6677] shift exponent -247 is negative
This patch avoid this error.
In the Linux kernel, the following vulnerability has been resolved:
media: imx-jpeg: Disable useless interrupt to avoid kernel panic
There is a hardware bug that the interrupt STMBUFHALF may be triggered after or when disable interrupt. It may led to unexpected kernel panic. And interrupt STMBUFHALF and STMBUFRTND have no other effect. So disable them and the unused interrupts.
meanwhile clear the interrupt status when disable interrupt.
In the Linux kernel, the following vulnerability has been resolved:
wifi: brcmfmac: fix invalid address access when enabling SCAN log level
The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid.
We replace reqs index with ri to fix the issue.
[ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmfpnoconfigschedscans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmfpnoconfigschedscans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmfpnoconfigschedscans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmfpnostartschedscan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmfcfg80211schedscanstart+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211startschedscan+0x140/0x308 [cfg80211] [ 136.937298] genlrcvmsg+0x358/0x3f4 [ 136.940960] netlinkrcvskb+0xb4/0x118 [ 136.944795] genlrcv+0x34/0x48 [ 136.947935] netlinkunicast+0x264/0x300 [ 136.951856] netlinksendmsg+0x2e4/0x33c [ 136.955781] syssendto+0x120/0x19c
In the Linux kernel, the following vulnerability has been resolved:
wifi: ath9k: hifusb: fix memory leak of urbs in ath9khifusbdealloctxurbs()
Syzkaller reports a long-known leak of urbs in ath9khifusbdealloctxurbs().
The cause of the leak is that usbgeturb() is called but usbfreeurb() (or usbputurb()) is not called inside usbkillurb() as urb->dev or urb->ep fields have not been initialized and usbkillurb() returns immediately.
The patch removes trying to kill urbs located in hifdev->tx.txbuf because hifdev->tx.txbuf is not supposed to contain urbs which are in pending state (the pending urbs are stored in hifdev->tx.txpending). The tx.txlock is acquired so there should not be any changes in the list.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
In the Linux kernel, the following vulnerability has been resolved:
net: stmmac: fix possible memory leak in stmmacdvrprobe()
The bitmapfree() should be called to free priv->afxdpzcqps when createsinglethreadworkqueue() fails, otherwise there will be a memory leak, so we add the err path errorwqinit to fix it.
In the Linux kernel, the following vulnerability has been resolved:
apparmor: fix a memleak in multitransactionnew()
In multitransactionnew(), the variable t is not freed or passed out on the failure of copyfromuser(t->data, buf, size), which could lead to a memleak.
Fix this bug by adding a putmultitransaction(t) in the error path.
In the Linux kernel, the following vulnerability has been resolved:
regulator: core: Use different devices for resource allocation and DT lookup
Following by the below discussion, there's the potential UAF issue between regulator and mfd. https://lore.kernel.org/all/20221128143601.1698148-1-yangyingliang@huawei.com/
From the analysis of Yingliang
CPU A |CPU B mt6370probe() | devmmfdadddevices() | |mt6370regulatorprobe() | regulatorregister() | //allocate initdata and add it to devres | regulatorofgetinitdata() i2cunregisterdevice() | devicedel() | devresreleaseall() | // initdata is freed | releasenodes() | | // using initdata causes UAF | regulatorregister()
It's common to use mfd core to create child device for the regulator. In order to do the DT lookup for init data, the child that registered the regulator would pass its parent as the parameter. And this causes init data resource allocated to its parent, not itself. The issue happen when parent device is going to release and regulator core is still doing some operation of init data constraint for the regulator of child device.
To fix it, this patch expand 'regulatorregister' API to use the different devices for init data allocation and DT lookup.
In the Linux kernel, the following vulnerability has been resolved:
wifi: iwlwifi: mei: fix potential NULL-ptr deref after clone
If cloning the SKB fails, don't try to use it, but rather return as if we should pass it.
Coverity CID: 1503456
In the Linux kernel, the following vulnerability has been resolved:
ipu3-imgu: Fix NULL pointer dereference in imgusubdevsetselection()
Calling v4l2subdevgettrycrop() and v4l2subdevgettrycompose() with a subdev state of NULL leads to a NULL pointer dereference. This can currently happen in imgusubdevsetselection() when the state passed in is NULL, as this method first gets pointers to both the "try" and "active" states and only then decides which to use.
The same issue has been addressed for imgusubdevgetselection() with commit 30d03a0de650 ("ipu3-imgu: Fix NULL pointer dereference in active selection access"). However the issue still persists in imgusubdevsetselection().
Therefore, apply a similar fix as done in the aforementioned commit to imgusubdevsetselection(). To keep things a bit cleaner, introduce helper functions for "crop" and "compose" access and use them in both imgusubdevsetselection() and imgusubdevgetselection().
In the Linux kernel, the following vulnerability has been resolved:
PCI: Fix pcideviceispresent() for VFs by checking PF
pcideviceispresent() previously didn't work for VFs because it reads the Vendor and Device ID, which are 0xffff for VFs, which looks like they aren't present. Check the PF instead.
Wei Gong reported that if virtio I/O is in progress when the driver is unbound or "0" is written to /sys/.../sriovnumvfs, the virtio I/O operation hangs, which may result in output like this:
task:bash state:D stack: 0 pid: 1773 ppid: 1241 flags:0x00004002 Call Trace: schedule+0x4f/0xc0 blkmqfreezequeuewait+0x69/0xa0 blkmqfreezequeue+0x1b/0x20 blkcleanupqueue+0x3d/0xd0 virtblkremove+0x3c/0xb0 [virtioblk] virtiodevremove+0x4b/0x80 ... deviceunregister+0x1b/0x60 unregistervirtiodevice+0x18/0x30 virtiopciremove+0x41/0x80 pcideviceremove+0x3e/0xb0
This happened because pcideviceispresent(VF) returned "false" in virtiopciremove(), so it called virtiobreakdevice(). The broken vq meant that vringinterrupt() skipped the vq.callback() that would have completed the virtio I/O operation via virtblkdone().
[bhelgaas: commit log, simplify to always use pciphysfn(), add stable tag]
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}timer works
syzbot is reporting attempt to schedule hdev->cmdwork work from systemwq WQ into hdev->workqueue WQ which is under draining operation [1], for commit c8efcc2589464ac7 ("workqueue: allow chained queueing during destruction") does not allow such operation.
The check introduced by commit 877afadad2dce8aa ("Bluetooth: When HCI work queue is drained, only queue chained work") was incomplete.
Use hdev->workqueue WQ when queuing hdev->{cmd,ncmd}timer works because hci{cmd,ncmd}timeout() calls queuework(hdev->workqueue). Also, protect the queuing operation with RCU read lock in order to avoid calling queuedelayedwork() after canceldelayedwork() completed.
In the Linux kernel, the following vulnerability has been resolved:
scsi: core: Wake up the error handler when final completions race against each other
The fragile ordering between marking commands completed or failed so that the error handler only wakes when the last running command completes or times out has race conditions. These race conditions can cause the SCSI layer to fail to wake the error handler, leaving I/O through the SCSI host stuck as the error state cannot advance.
First, there is an memory ordering issue within scsidechostbusy(). The write which clears SCMDSTATEINFLIGHT may be reordered with reads counting in scsihostbusy(). While the local CPU will see its own write, reordering can allow other CPUs in scsidechostbusy() or scsiehinchostfailed() to see a raised busy count, causing no CPU to see a host busy equal to the hostfailed count.
This race condition can be prevented with a memory barrier on the error path to force the write to be visible before counting host busy commands.
Second, there is a general ordering issue with scsiehinchostfailed(). By counting busy commands before incrementing hostfailed, it can race with a final command in scsidechostbusy(), such that scsidechostbusy() does not see hostfailed incremented but scsiehinchostfailed() counts busy commands before SCMDSTATEINFLIGHT is cleared by scsidechostbusy(), resulting in neither waking the error handler task.
This needs the call to scsihostbusy() to be moved after hostfailed is incremented to close the race condition.
In the Linux kernel, the following vulnerability has been resolved:
net: add proper RCU protection to /proc/net/ptype
Yin Fengwei reported an RCU stall in ptypeseqshow() and provided a patch.
Real issue is that ptypeseqnext() and ptypeseqshow() violate RCU rules.
ptypeseqshow() runs under rcureadlock(), and reads pt->dev to get device name without any barrier.
At the same time, concurrent writers can remove a packettype structure (which is correctly freed after an RCU grace period) and clear pt->dev without an RCU grace period.
Define ptypeiterstate to carry a dev pointer along seqnetprivate:
struct ptypeiterstate { struct seqnetprivate p; struct netdevice dev; // added in this patch };
We need to record the device pointer in ptypegetidx() and ptypeseqnext() so that ptypeseqshow() is safe against concurrent pt->dev changes.
We also need to add full RCU protection in ptypeseqnext(). (Missing READONCE() when reading list.next values)
Many thanks to Dong Chenchen for providing a repro.
In the Linux kernel, the following vulnerability has been resolved:
idpf: fix error handling in the inittask on load
If the inittask fails during a driver load, we end up without vports and netdevs, effectively failing the entire process. In that state a subsequent reset will result in a crash as the service task attempts to access uninitialized resources. Following trace is from an error in the inittask where the CREATEVPORT (op 501) is rejected by the FW:
[40922.763136] idpf 0000:83:00.0: Device HW Reset initiated [40924.449797] idpf 0000:83:00.0: Transaction failed (op 501) [40958.148190] idpf 0000:83:00.0: HW reset detected [40958.161202] BUG: kernel NULL pointer dereference, address: 00000000000000a8 ... [40958.168094] Workqueue: idpf-0000:83:00.0-vcevent idpfvceventtask [idpf] [40958.168865] RIP: 0010:idpfvceventtask+0x9b/0x350 [idpf] ... [40958.177932] Call Trace: [40958.178491] <TASK> [40958.179040] processonework+0x226/0x6d0 [40958.179609] workerthread+0x19e/0x340 [40958.180158] ? pfxworkerthread+0x10/0x10 [40958.180702] kthread+0x10f/0x250 [40958.181238] ? pfxkthread+0x10/0x10 [40958.181774] retfromfork+0x251/0x2b0 [40958.182307] ? pfxkthread+0x10/0x10 [40958.182834] retfromforkasm+0x1a/0x30 [40958.183370] </TASK>
Fix the error handling in the inittask to make sure the service and mailbox tasks are disabled if the error happens during load. These are started in idpfvccoreinit(), which spawns the inittask and has no way of knowing if it failed. If the error happens on reset, following successful driver load, the tasks can still run, as that will allow the netdevs to attempt recovery through another reset. Stop the PTP callbacks either way as those will be restarted by the call to idpfvccoreinit() during a successful reset.
In the Linux kernel, the following vulnerability has been resolved:
net: hvnetvsc: reject RSS hash key programming without RX indirection table
RSS configuration requires a valid RX indirection table. When the device reports a single receive queue, rndisfilterdeviceadd() does not allocate an indirection table, accepting RSS hash key updates in this state leads to a hang.
Fix this by gating netvscsetrxfh() on ndc->rxtablesz and return -EOPNOTSUPP when the table is absent. This aligns setrxfh with the device capabilities and prevents incorrect behavior.
In the Linux kernel, the following vulnerability has been resolved:
netdevsim: fix a race issue related to the operation on bpfboundprogs list
The netdevsim driver lacks a protection mechanism for operations on the bpfboundprogs list. When the nsimbpfcreateprog() performs listaddtail, it is possible that nsimbpfdestroyprog() is simultaneously performs listdel. Concurrent operations on the list may lead to list corruption and trigger a kernel crash as follows:
[ 417.290971] kernel BUG at lib/listdebug.c:62! [ 417.290983] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 417.290992] CPU: 10 PID: 168 Comm: kworker/10:1 Kdump: loaded Not tainted 6.19.0-rc5 #1 [ 417.291003] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 417.291007] Workqueue: events bpfprogfreedeferred [ 417.291021] RIP: 0010:listdelentryvalidorreport+0xa7/0xc0 [ 417.291034] Code: a8 ff 0f 0b 48 89 fe 48 89 ca 48 c7 c7 48 a1 eb ae e8 ed fb a8 ff 0f 0b 48 89 fe 48 89 c2 48 c7 c7 80 a1 eb ae e8 d9 fb a8 ff <0f> 0b 48 89 d1 48 c7 c7 d0 a1 eb ae 48 89 f2 48 89 c6 e8 c2 fb a8 [ 417.291040] RSP: 0018:ffffb16a40807df8 EFLAGS: 00010246 [ 417.291046] RAX: 000000000000006d RBX: ffff8e589866f500 RCX: 0000000000000000 [ 417.291051] RDX: 0000000000000000 RSI: ffff8e59f7b23180 RDI: ffff8e59f7b23180 [ 417.291055] RBP: ffffb16a412c9000 R08: 0000000000000000 R09: 0000000000000003 [ 417.291059] R10: ffffb16a40807c80 R11: ffffffffaf9edce8 R12: ffff8e594427ac20 [ 417.291063] R13: ffff8e59f7b44780 R14: ffff8e58800b7a05 R15: 0000000000000000 [ 417.291074] FS: 0000000000000000(0000) GS:ffff8e59f7b00000(0000) knlGS:0000000000000000 [ 417.291079] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 417.291083] CR2: 00007fc4083efe08 CR3: 00000001c3626006 CR4: 0000000000770ee0 [ 417.291088] PKRU: 55555554 [ 417.291091] Call Trace: [ 417.291096] <TASK> [ 417.291103] nsimbpfdestroyprog+0x31/0x80 [netdevsim] [ 417.291154] bpfprogoffloaddestroy+0x2a/0x80 [ 417.291163] bpfprogdevbounddestroy+0x6f/0xb0 [ 417.291171] bpfprogfreedeferred+0x18e/0x1a0 [ 417.291178] processonework+0x18a/0x3a0 [ 417.291188] workerthread+0x27b/0x3a0 [ 417.291197] ? pfxworkerthread+0x10/0x10 [ 417.291207] kthread+0xe5/0x120 [ 417.291214] ? pfxkthread+0x10/0x10 [ 417.291221] retfromfork+0x31/0x50 [ 417.291230] ? pfxkthread+0x10/0x10 [ 417.291236] retfromforkasm+0x1a/0x30 [ 417.291246] </TASK>
Add a mutex lock, to prevent simultaneous addition and deletion operations on the list.
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nftables: avoid chain re-validation if possible
Hamza Mahfooz reports cpu soft lock-ups in nftchainvalidate():
watchdog: BUG: soft lockup - CPU#1 stuck for 27s! [iptables-nft-re:37547] [..] RIP: 0010:nftchainvalidate+0xcb/0x110 [nftables] [..] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nftimmediatevalidate+0x36/0x50 [nftables] nftchainvalidate+0xc9/0x110 [nftables] nfttablevalidate+0x6b/0xb0 [nftables] nftablesvalidate+0x8b/0xa0 [nftables] nftablescommit+0x1df/0x1eb0 [nftables] [..]
Currently nftables will traverse the entire table (chain graph), starting from the entry points (base chains), exploring all possible paths (chain jumps). But there are cases where we could avoid revalidation.
Consider: 1 input -> j2 -> j3 2 input -> j2 -> j3 3 input -> j1 -> j2 -> j3
Then the second rule does not need to revalidate j2, and, by extension j3, because this was already checked during validation of the first rule. We need to validate it only for rule 3.
This is needed because chain loop detection also ensures we do not exceed the jump stack: Just because we know that j2 is cycle free, its last jump might now exceed the allowed stack size. We also need to update all reachable chains with the new largest observed call depth.
Care has to be taken to revalidate even if the chain depth won't be an issue: chain validation also ensures that expressions are not called from invalid base chains. For example, the masquerade expression can only be called from NAT postrouting base chains.
Therefore we also need to keep record of the base chain context (type, hooknum) and revalidate if the chain becomes reachable from a different hook location.
In the Linux kernel, the following vulnerability has been resolved:
net: dsa: microchip: Don't free uninitialized kszirq
If something goes wrong at setup, kszirqfree() can be called on uninitialized kszirq (for example when kszptpirqsetup() fails). It leads to freeing uninitialized IRQ numbers and/or domains.
Use dsaswitchforeachuserportcontinuereverse() in the error path to iterate only over the fully initialized ports.
In the Linux kernel, the following vulnerability has been resolved:
ipv6: fix a BUG in rt6getpcpuroute() under PREEMPTRT
On PREEMPTRT kernels, after rt6getpcpuroute() returns NULL, the current task can be preempted. Another task running on the same CPU may then execute rt6makepcpuroute() and successfully install a pcpurt entry. When the first task resumes execution, its cmpxchg() in rt6makepcpuroute() will fail because rt6ipcpu is no longer NULL, triggering the BUGON(prev). It's easy to reproduce it by adding mdelay() after rt6getpcpuroute().
Using preemptdisable/enable is not appropriate here because ip6rtpcpualloc() may sleep.
Fix this by handling the cmpxchg() failure gracefully on PREEMPTRT: free our allocation and return the existing pcpurt installed by another task. The BUGON is replaced by WARNONONCE for non-PREEMPTRT kernels where such races should not occur.
In the Linux kernel, the following vulnerability has been resolved:
landlock: Fix handling of disconnected directories
Disconnected files or directories can appear when they are visible and opened from a bind mount, but have been renamed or moved from the source of the bind mount in a way that makes them inaccessible from the mount point (i.e. out of scope).
Previously, access rights tied to files or directories opened through a disconnected directory were collected by walking the related hierarchy down to the root of the filesystem, without taking into account the mount point because it couldn't be found. This could lead to inconsistent access results, potential access right widening, and hard-to-debug renames, especially since such paths cannot be printed.
For a sandboxed task to create a disconnected directory, it needs to have write access (i.e. FSMAKEREG, FSREMOVEFILE, and FSREFER) to the underlying source of the bind mount, and read access to the related mount point. Because a sandboxed task cannot acquire more access rights than those defined by its Landlock domain, this could lead to inconsistent access rights due to missing permissions that should be inherited from the mount point hierarchy, while inheriting permissions from the filesystem hierarchy hidden by this mount point instead.
Landlock now handles files and directories opened from disconnected directories by taking into account the filesystem hierarchy when the mount point is not found in the hierarchy walk, and also always taking into account the mount point from which these disconnected directories were opened. This ensures that a rename is not allowed if it would widen access rights [1].
The rationale is that, even if disconnected hierarchies might not be visible or accessible to a sandboxed task, relying on the collected access rights from them improves the guarantee that access rights will not be widened during a rename because of the access right comparison between the source and the destination (see LANDLOCKACCESSFSREFER). It may look like this would grant more access on disconnected files and directories, but the security policies are always enforced for all the evaluated hierarchies. This new behavior should be less surprising to users and safer from an access control perspective.
Remove a wrong WARNONONCE() canary in collectdomainaccesses() and fix the related comment.
Because opened files have their access rights stored in the related file security properties, there is no impact for disconnected or unlinked files.
can: gsusb: gsusbreceivebulkcallback(): check actuallength before accessing header