A flaw was found in the Linux kernel. The PTRACESEIZE code path allows attackers to bypass intended restrictions on setting the PTSUSPENDSECCOMP flag, possibly disabling seccomp.
A use-after-free flaw was found in usbsgcancel in drivers/usb/core/message.c in USB core subsystem. This flaw could allow a local attacker with special user privilege (or root) to crash the system due to a race problem in scatter-gather cancellation and transfer completion in usbsgwait. This vulnerability can even lead to a kernel information leak problem .
Here usbsgcancel() does not take any reference to the transfer and there is nothing to prevent the URBs from being deallocated while the routine is trying to use them.
Taking a reference by incrementing the transfer's io->count field while the cancellation is in progress and decrementing it afterwards can be way to address this. The transfer's URBs are not deallocated until io->complete is triggered, which happens when io->count reaches zero. ~~~ BUG: KASAN: use-after-free in atomicread include/asm-generic/atomic-instrumented.h:26 [inline] BUG: KASAN: use-after-free in usbhcdunlinkurb+0x5f/0x170 drivers/usb/core/hcd.c:1607 Read of size 4 at addr ffff888065379610 by task kworker/u4:1/27 ~~~
References: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.6.8 https://lkml.org/lkml/2020/3/23/52
Upstream commit: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=056ad39ee9253873522f6469c3364964a322912b
A vulnerability was found in linux kernel, where an information leak occurs via ext4extentheader to userspace.
HID: core: zero-initialize the report buffer
An out-of-bounds write flaw was found in the Linux kernel. A crafted keycode table could be used by drivers/input/input.c to perform the out-of-bounds write. A local user with root access can insert garbage to this keycode table that can lead to out-of-bounds memory access. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
A flaw in the Linux kernel's WiFi beacon validation code was discovered. The code does not check the length of the variable length elements in the beacon head potentially leading to a buffer overflow. System availability, as well as data confidentiality and integrity, can be impacted by this vulnerability.
A use-after-free flaw was observed in blkdevget(), in fs/blockdev.c after a call to blkdevget() fails, and its refcount gets freed/released. This problem may cause a denial of service problem with a special user privilege, and may even lead to a confidentiality issue.
In tgmdmattinit of tt.c, there is a possible kernel memory corruption due to a use after free. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.
In the Linux kernel, the following vulnerability has been resolved:
scsi: scsidebug: Sanity check block descriptor length in respmodeselect()
In respmodeselect() sanity check the block descriptor len to avoid UAF.
BUG: KASAN: use-after-free in respmodeselect+0xa4c/0xb40 drivers/scsi/scsidebug.c:2509 Read of size 1 at addr ffff888026670f50 by task scsicmd/15032
CPU: 1 PID: 15032 Comm: scsicmd Not tainted 5.15.0-01d0625 #15 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Call Trace: <TASK> dumpstacklvl+0x89/0xb5 lib/dumpstack.c:107 printaddressdescription.constprop.9+0x28/0x160 mm/kasan/report.c:257 kasanreport.cold.14+0x7d/0x117 mm/kasan/report.c:443 asanreportload1noabort+0x14/0x20 mm/kasan/reportgeneric.c:306 respmodeselect+0xa4c/0xb40 drivers/scsi/scsidebug.c:2509 scheduleresp+0x4af/0x1a10 drivers/scsi/scsidebug.c:5483 scsidebugqueuecommand+0x8c9/0x1e70 drivers/scsi/scsidebug.c:7537 scsiqueuerq+0x16b4/0x2d10 drivers/scsi/scsilib.c:1521 blkmqdispatchrqlist+0xb9b/0x2700 block/blk-mq.c:1640 blkmqscheddispatchrequests+0x28f/0x590 block/blk-mq-sched.c:325 blkmqscheddispatchrequests+0x105/0x190 block/blk-mq-sched.c:358 blkmqrunhwqueue+0xe5/0x150 block/blk-mq.c:1762 blkmqdelayrunhwqueue+0x4f8/0x5c0 block/blk-mq.c:1839 blkmqrunhwqueue+0x18d/0x350 block/blk-mq.c:1891 blkmqschedinsertrequest+0x3db/0x4e0 block/blk-mq-sched.c:474 blkexecuterqnowait+0x16b/0x1c0 block/blk-exec.c:63 sgcommonwrite.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:837 sgnewwrite.isra.19+0x570/0x8c0 drivers/scsi/sg.c:775 sgioctlcommon+0x14d6/0x2710 drivers/scsi/sg.c:941 sgioctl+0xa2/0x180 drivers/scsi/sg.c:1166 x64sysioctl+0x19d/0x220 fs/ioctl.c:52 dosyscall64+0x3a/0x80 arch/x86/entry/common.c:50 entrySYSCALL64afterhwframe+0x44/0xae arch/x86/entry/entry64.S:113
In the Linux kernel, the following vulnerability has been resolved:
wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
A bad USB device is able to construct a service connection response message with target endpoint being ENDPOINT0 which is reserved for HTCCTRLRSVDSVC and should not be modified to be used for any other services.
Reject such service connection responses.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
In the Linux kernel, the following vulnerability has been resolved:
wifi: brcmfmac: slab-out-of-bounds read in brcmfgetassocies()
Fix a slab-out-of-bounds read that occurs in kmemdup() called from brcmfgetassocies(). The bug could occur when associnfo->reqlen, data from a URB provided by a USB device, is bigger than the size of buffer which is defined as WLEXTRABUFMAX.
Add the size check for reqlen/resplen of associnfo.
Found by a modified version of syzkaller.
[ 46.592467][ T7] ================================================================== [ 46.594687][ T7] BUG: KASAN: slab-out-of-bounds in kmemdup+0x3e/0x50 [ 46.596572][ T7] Read of size 3014656 at addr ffff888019442000 by task kworker/0:1/7 [ 46.598575][ T7] [ 46.599157][ T7] CPU: 0 PID: 7 Comm: kworker/0:1 Tainted: G O 5.14.0+ #145 [ 46.601333][ T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 46.604360][ T7] Workqueue: events brcmffweheventworker [ 46.605943][ T7] Call Trace: [ 46.606584][ T7] dumpstacklvl+0x8e/0xd1 [ 46.607446][ T7] printaddressdescription.constprop.0.cold+0x93/0x334 [ 46.608610][ T7] ? kmemdup+0x3e/0x50 [ 46.609341][ T7] kasanreport.cold+0x79/0xd5 [ 46.610151][ T7] ? kmemdup+0x3e/0x50 [ 46.610796][ T7] kasancheckrange+0x14e/0x1b0 [ 46.611691][ T7] memcpy+0x20/0x60 [ 46.612323][ T7] kmemdup+0x3e/0x50 [ 46.612987][ T7] brcmfgetassocies+0x967/0xf60 [ 46.613904][ T7] ? brcmfnotifyvifevent+0x3d0/0x3d0 [ 46.614831][ T7] ? lockchaincount+0x20/0x20 [ 46.615683][ T7] ? marklock.part.0+0xfc/0x2770 [ 46.616552][ T7] ? lockchaincount+0x20/0x20 [ 46.617409][ T7] ? marklock.part.0+0xfc/0x2770 [ 46.618244][ T7] ? lockchaincount+0x20/0x20 [ 46.619024][ T7] brcmfbssconnectdone.constprop.0+0x241/0x2e0 [ 46.620019][ T7] ? brcmfparseconfiguresecurity.isra.0+0x2a0/0x2a0 [ 46.620818][ T7] ? lockacquire+0x181f/0x5790 [ 46.621462][ T7] brcmfnotifyconnectstatus+0x448/0x1950 [ 46.622134][ T7] ? rcureadlockbhheld+0xb0/0xb0 [ 46.622736][ T7] ? brcmfcfg80211joinibss+0x7b0/0x7b0 [ 46.623390][ T7] ? findheldlock+0x2d/0x110 [ 46.623962][ T7] ? brcmffweheventworker+0x19f/0xc60 [ 46.624603][ T7] ? markheldlocks+0x9f/0xe0 [ 46.625145][ T7] ? lockdephardirqsonprepare+0x3e0/0x3e0 [ 46.625871][ T7] ? brcmfcfg80211joinibss+0x7b0/0x7b0 [ 46.626545][ T7] brcmffwehcalleventhandler.isra.0+0x90/0x100 [ 46.627338][ T7] brcmffweheventworker+0x557/0xc60 [ 46.627962][ T7] ? brcmffwehcalleventhandler.isra.0+0x100/0x100 [ 46.628736][ T7] ? rcureadlockschedheld+0xa1/0xd0 [ 46.629396][ T7] ? rcureadlockbhheld+0xb0/0xb0 [ 46.629970][ T7] ? lockdephardirqsonprepare+0x273/0x3e0 [ 46.630649][ T7] processonework+0x92b/0x1460 [ 46.631205][ T7] ? pwqdecnrinflight+0x330/0x330 [ 46.631821][ T7] ? rwlockbug.part.0+0x90/0x90 [ 46.632347][ T7] workerthread+0x95/0xe00 [ 46.632832][ T7] ? kthreadparkme+0x115/0x1e0 [ 46.633393][ T7] ? processonework+0x1460/0x1460 [ 46.633957][ T7] kthread+0x3a1/0x480 [ 46.634369][ T7] ? setkthreadstruct+0x120/0x120 [ 46.634933][ T7] retfromfork+0x1f/0x30 [ 46.635431][ T7] [ 46.635687][ T7] Allocated by task 7: [ 46.636151][ T7] kasansavestack+0x1b/0x40 [ 46.636628][ T7] kasankmalloc+0x7c/0x90 [ 46.637108][ T7] kmemcachealloctrace+0x19e/0x330 [ 46.637696][ T7] brcmfcfg80211attach+0x4a0/0x4040 [ 46.638275][ T7] brcmfattach+0x389/0xd40 [ 46.638739][ T7] brcmfusbprobe+0x12de/0x1690 [ 46.639279][ T7] usbprobeinterface+0x2aa/0x760 [ 46.639820][ T7] reallyprobe+0x205/0xb70 [ 46.640342][ T7] driverprobedevice+0 ---truncated---
In the Linux kernel, the following vulnerability has been resolved:
net: altera: Fix refcount leak in alteratsemdiocreate
Every iteration of foreachchildofnode() decrements the reference count of the previous node. When break from a foreachchildofnode() loop, we need to explicitly call ofnodeput() on the child node when not need anymore. Add missing ofnodeput() to avoid refcount leak.
In the Linux kernel, the following vulnerability has been resolved:
firmware: dmi-sysfs: Fix memory leak in dmisysfsregisterhandle
kobjectinitandadd() takes reference even when it fails. According to the doc of kobjectinitandadd()
If this function returns an error, kobjectput() must be called to properly clean up the memory associated with the object.
Fix this issue by calling kobjectput().
In the Linux kernel, the following vulnerability has been resolved:
tipc: check attribute length for bearer name
syzbot reported uninit-value: ===================================================== BUG: KMSAN: uninit-value in stringnocheck lib/vsprintf.c:644 [inline] BUG: KMSAN: uninit-value in string+0x4f9/0x6f0 lib/vsprintf.c:725 stringnocheck lib/vsprintf.c:644 [inline] string+0x4f9/0x6f0 lib/vsprintf.c:725 vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806 vprintkstore+0x537/0x2150 kernel/printk/printk.c:2158 vprintkemit+0x28b/0xab0 kernel/printk/printk.c:2256 vprintkdefault+0x86/0xa0 kernel/printk/printk.c:2283 vprintk+0x15f/0x180 kernel/printk/printksafe.c:50 printk+0x18d/0x1cf kernel/printk/printk.c:2293 tipcenablebearer net/tipc/bearer.c:371 [inline] tipcnlbearerenable+0x2022/0x22a0 net/tipc/bearer.c:1033 tipcnlbearerenable+0x6c/0xb0 net/tipc/bearer.c:1042 genlfamilyrcvmsgdoit net/netlink/genetlink.c:731 [inline]
- Do sanity check the attribute length for TIPCNLABEARERNAME. - Do not use 'illegal name' in printing message.
In the Linux kernel, the following vulnerability has been resolved:
jffs2: fix memory leak in jffs2dofillsuper
If jffs2iget() or dmakeroot() in jffs2dofillsuper() returns an error, we can observe the following kmemleak report:
-------------------------------------------- unreferenced object 0xffff888105a65340 (size 64): comm "mount", pid 710, jiffies 4302851558 (age 58.239s) 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: [<ffffffff859c45e5>] kmemcachealloctrace+0x475/0x8a0 [<ffffffff86160146>] jffs2suminit+0x96/0x1a0 [<ffffffff86140e25>] jffs2domountfs+0x745/0x2120 [<ffffffff86149fec>] jffs2dofillsuper+0x35c/0x810 [<ffffffff8614aae9>] jffs2fillsuper+0x2b9/0x3b0 [...] unreferenced object 0xffff8881bd7f0000 (size 65536): comm "mount", pid 710, jiffies 4302851558 (age 58.239s) hex dump (first 32 bytes): bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb ................ bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb ................ backtrace: [<ffffffff858579ba>] kmallocorder+0xda/0x110 [<ffffffff85857a11>] kmallocordertrace+0x21/0x130 [<ffffffff859c2ed1>] kmalloc+0x711/0x8a0 [<ffffffff86160189>] jffs2suminit+0xd9/0x1a0 [<ffffffff86140e25>] jffs2domountfs+0x745/0x2120 [<ffffffff86149fec>] jffs2dofillsuper+0x35c/0x810 [<ffffffff8614aae9>] jffs2fillsuper+0x2b9/0x3b0 [...] --------------------------------------------
This is because the resources allocated in jffs2suminit() are not released. Call jffs2sumexit() to release these resources to solve the problem.
In the Linux kernel, the following vulnerability has been resolved:
usb: usbip: fix a refcount leak in stubprobe()
usbgetdev() is called in stubdevicealloc(). When stubprobe() fails after that, usbputdev() needs to be called to release the reference.
Fix this by moving usbputdev() to sdevfree error path handling.
Find this by code review.
In the Linux kernel, the following vulnerability has been resolved:
drivers: usb: host: Fix deadlock in oxubussuspend()
There is a deadlock in oxubussuspend(), which is shown below:
(Thread 1) | (Thread 2) | timeraction() oxubussuspend() | modtimer() spinlockirq() //(1) | (wait a time) ... | oxuwatchdog() deltimersync() | spinlockirq() //(2) (wait timer to stop) | ...
We hold oxu->lock in position (1) of thread 1, and use deltimersync() to wait timer to stop, but timer handler also need oxu->lock in position (2) of thread 2. As a result, oxubussuspend() will block forever.
This patch extracts deltimersync() from the protection of spinlockirq(), which could let timer handler to obtain the needed lock.
In the Linux kernel, the following vulnerability has been resolved:
NFSv4: Don't hold the layoutget locks across multiple RPC calls
When doing layoutget as part of the open() compound, we have to be careful to release the layout locks before we can call any further RPC calls, such as setattr(). The reason is that those calls could trigger a recall, which could deadlock.
In the Linux kernel, the following vulnerability has been resolved:
drm/msm/mdp5: Return error code in mdp5piperelease when deadlock is detected
mdp5getglobalstate runs the risk of hitting a -EDEADLK when acquiring the modeset lock, but currently mdp5piperelease doesn't check for if an error is returned. Because of this, there is a possibility of mdp5piperelease hitting a NULL dereference error.
To avoid this, let's have mdp5piperelease check if mdp5getglobalstate returns an error and propogate that error.
Changes since v1: - Separated declaration and initialization of newstate to avoid compiler warning - Fixed some spelling mistakes in commit message
Changes since v2: - Return 0 in case where hwpipe is NULL as this is considered normal behavior - Added 2nd patch in series to fix a similar NULL dereference issue in mdp5mixerrelease
Patchwork: https://patchwork.freedesktop.org/patch/485179/
In the Linux kernel, the following vulnerability has been resolved:
ARM: versatile: Add missing ofnodeput in dcscbinit
The devicenode pointer is returned by offindcompatiblenode with refcount incremented. We should use ofnodeput() to avoid the refcount leak.
In the Linux kernel, the following vulnerability has been resolved:
net: phy: micrel: Allow probing without .driverdata
Currently, if the .probe element is present in the phydriver structure and the .driverdata is not, a NULL pointer dereference happens.
Allow passing .probe without .driverdata by inserting NULL checks for priv->type.
In the Linux kernel, the following vulnerability has been resolved:
drm/msm/mdp5: Return error code in mdp5mixerrelease when deadlock is detected
There is a possibility for mdp5getglobalstate to return -EDEADLK when acquiring the modeset lock, but currently globalstate in mdp5mixerrelease doesn't check for if an error is returned.
To avoid a NULL dereference error, let's have mdp5mixerrelease check if an error is returned and propagate that error.
Patchwork: https://patchwork.freedesktop.org/patch/485181/
In the Linux kernel, the following vulnerability has been resolved:
ARM: Fix refcount leak in axxiabootsecondary
offindcompatiblenode() returns a node pointer with refcount incremented, we should use ofnodeput() on it when done. Add missing ofnodeput() to avoid refcount leak.
In the Linux kernel, the following vulnerability has been resolved:
can: gsusb: gsusbopen/close(): fix memory leak
The gsusb driver appears to suffer from a malady common to many USB CAN adapter drivers in that it performs usballoccoherent() to allocate a number of USB request blocks (URBs) for RX, and then later relies on usbkillanchoredurbs() to free them, but this doesn't actually free them. As a result, this may be leaking DMA memory that's been used by the driver.
This commit is an adaptation of the techniques found in the esdusb2 driver where a similar design pattern led to a memory leak. It explicitly frees the RX URBs and their DMA memory via a call to usbfreecoherent(). Since the RX URBs were allocated in the gscanopen(), we remove them in gscanclose() rather than in the disconnect function as was done in esdusb2.
For more information, see the 928150fad41b ("can: esdusb2: fix memory leak").
In the Linux kernel, the following vulnerability has been resolved:
EDAC/highbank: Fix memory leak in highbankmcprobe()
When devresopengroup() fails, it returns -ENOMEM without freeing memory allocated by edacmcalloc().
Call edacmcfree() on the error handling path to avoid a memory leak.
[ bp: Massage commit message. ]
In the Linux kernel, the following vulnerability has been resolved:
9p/transfd: always use ONONBLOCK read/write
syzbot is reporting hung task at p9fdclose() [1], for p9muxpollstop() from p9conndestroy() from p9fdclose() is failing to interrupt already started kernelread() from p9fdread() from p9readwork() and/or kernelwrite() from p9fdwrite() from p9writework() requests.
Since p9socketopen() sets ONONBLOCK flag, p9muxpollstop() does not need to interrupt kernelread()/kernelwrite(). However, since p9fdopen() does not set ONONBLOCK flag, but pipe blocks unless signal is pending, p9muxpollstop() needs to interrupt kernelread()/kernelwrite() when the file descriptor refers to a pipe. In other words, pipe file descriptor needs to be handled as if socket file descriptor.
We somehow need to interrupt kernelread()/kernelwrite() on pipes.
A minimal change, which this patch is doing, is to set ONONBLOCK flag from p9fdopen(), for ONONBLOCK flag does not affect reading/writing of regular files. But this approach changes ONONBLOCK flag on userspace- supplied file descriptors (which might break userspace programs), and ONONBLOCK flag could be changed by userspace. It would be possible to set ONONBLOCK flag every time p9fdread()/p9fdwrite() is invoked, but still remains small race window for clearing ONONBLOCK flag.
If we don't want to manipulate ONONBLOCK flag, we might be able to surround kernelread()/kernelwrite() with setthreadflag(TIFSIGPENDING) and recalcsigpending(). Since p9readwork()/p9writework() works are processed by kernel threads which process global systemwq workqueue, signals could not be delivered from remote threads when p9muxpollstop() from p9conndestroy() from p9fdclose() is called. Therefore, calling setthreadflag(TIFSIGPENDING)/recalcsigpending() every time would be needed if we count on signals for making kernelread()/kernelwrite() non-blocking.
[Dominique: add comment at Christian's suggestion]
In the Linux kernel, the following vulnerability has been resolved:
net: dsa: Fix possible memory leaks in dsaloopinit()
kmemleak reported memory leaks in dsaloopinit():
kmemleak: 12 new suspected memory leaks
unreferenced object 0xffff8880138ce000 (size 2048): comm "modprobe", pid 390, jiffies 4295040478 (age 238.976s) backtrace: [<000000006a94f1d5>] kmalloctrace+0x26/0x60 [<00000000a9c44622>] phydevicecreate+0x5d/0x970 [<00000000d0ee2afc>] getphydevice+0xf3/0x2b0 [<00000000dca0c71f>] fixedphyregister.part.0+0x92/0x4e0 [<000000008a834798>] fixedphyregister+0x84/0xb0 [<0000000055223fcb>] dsaloopinit+0xa9/0x116 [dsaloop] ...
There are two reasons for memleak in dsaloopinit().
First, fixedphyregister() create and register phydevice:
fixedphyregister() getphydevice() phydevicecreate() # freed by phydevicefree() phydeviceregister() # freed by phydeviceremove()
But fixedphyunregister() only calls phydeviceremove(). So the memory allocated in phydevicecreate() is leaked.
Second, when mdiodriverregister() fail in dsaloopinit(), it just returns and there is no cleanup for phydevs.
Fix the problems by catching the error of mdiodriverregister() in dsaloopinit(), then calling both fixedphyunregister() and phydevicefree() to release phydevs. Also add a function for phydevs cleanup to avoid duplacate.
In the Linux kernel, the following vulnerability has been resolved:
vt: Clear selection before changing the font
When changing the console font with ioctl(KDFONTOP) the new font size can be bigger than the previous font. A previous selection may thus now be outside of the new screen size and thus trigger out-of-bounds accesses to graphics memory if the selection is removed in vcdoresize().
Prevent such out-of-memory accesses by dropping the selection before the various confontset() console handlers are called.
In the Linux kernel, the following vulnerability has been resolved:
usb: host: ohci-ppc-of: Fix refcount leak bug
In ohcihcdppcofprobe(), offindcompatiblenode() will return a node pointer with refcount incremented. We should use ofnodeput() when it is not used anymore.
In the Linux kernel, the following vulnerability has been resolved:
tty: serial: Fix refcount leak bug in uccuart.c
In socinfo(), offindnodebytype() will return a node pointer with refcount incremented. We should use ofnodeput() when it is not used anymore.