No description
Find a file
Chen Zhongjin 8d21554ec7 ASoC: core: Fix use-after-free in snd_soc_exit()
[ Upstream commit 6ec27c5388 ]

KASAN reports a use-after-free:

BUG: KASAN: use-after-free in device_del+0xb5b/0xc60
Read of size 8 at addr ffff888008655050 by task rmmod/387
CPU: 2 PID: 387 Comm: rmmod
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
Call Trace:
<TASK>
dump_stack_lvl+0x79/0x9a
print_report+0x17f/0x47b
kasan_report+0xbb/0xf0
device_del+0xb5b/0xc60
platform_device_del.part.0+0x24/0x200
platform_device_unregister+0x2e/0x40
snd_soc_exit+0xa/0x22 [snd_soc_core]
__do_sys_delete_module.constprop.0+0x34f/0x5b0
do_syscall_64+0x3a/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
...
</TASK>

It's bacause in snd_soc_init(), snd_soc_util_init() is possble to fail,
but its ret is ignored, which makes soc_dummy_dev unregistered twice.

snd_soc_init()
    snd_soc_util_init()
        platform_device_register_simple(soc_dummy_dev)
        platform_driver_register() # fail
    	platform_device_unregister(soc_dummy_dev)
    platform_driver_register() # success
...
snd_soc_exit()
    snd_soc_util_exit()
    # soc_dummy_dev will be unregistered for second time

To fix it, handle error and stop snd_soc_init() when util_init() fail.
Also clean debugfs when util_init() or driver_register() fail.

Fixes: fb257897bf ("ASoC: Work around allmodconfig failure")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Link: https://lore.kernel.org/r/20221028031603.59416-1-chenzhongjin@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-25 17:45:42 +01:00
arch x86/cpu: Restore AMD's DE_CFG MSR after resume 2022-11-16 09:57:20 +01:00
block block, bfq: protect 'bfqd->queued' by 'bfqd->lock' 2022-11-10 18:14:24 +01:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:13:17 +02:00
crypto crypto: akcipher - default implementation for setting a private key 2022-10-26 13:25:42 +02:00
Documentation KVM: s390: pv: don't allow userspace to set the clock under PV 2022-11-16 09:57:10 +01:00
drivers spi: stm32: Print summary 'callbacks suppressed' message 2022-11-25 17:45:42 +01:00
fs btrfs: remove pointless and double ulist frees in error paths of qgroup tests 2022-11-25 17:45:40 +01:00
include mtd: spi-nor: intel-spi: Disable write protection only if asked 2022-11-25 17:45:41 +01:00
init Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug 2022-06-09 10:21:25 +02:00
ipc ipc: remove memcg accounting for sops objects in do_semtimedop() 2022-11-10 18:14:29 +01:00
kernel bpf: Fix wrong reg type conversion in release_reference() 2022-11-16 09:57:09 +01:00
lib dyndbg: drop EXPORTed dynamic_debug_exec_queries 2022-10-26 13:25:34 +02:00
LICENSES
mm mm/memremap.c: map FS_DAX device memory as decrypted 2022-11-16 09:57:17 +01:00
net Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm 2022-11-25 17:45:40 +01:00
samples x86: Prepare inline-asm for straight-line-speculation 2022-07-25 11:26:29 +02:00
scripts cert host tools: Stop complaining about deprecated OpenSSL functions 2022-11-16 09:57:17 +01:00
security capabilities: fix potential memleak on error path from vfs_getxattr_alloc() 2022-11-10 18:14:26 +01:00
sound ASoC: core: Fix use-after-free in snd_soc_exit() 2022-11-25 17:45:42 +01:00
tools selftests/intel_pstate: fix build for ARCH=x86_64 2022-11-25 17:45:39 +01:00
usr
virt kvm: Add support for arch compat vm ioctls 2022-10-30 09:41:15 +01:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: add Amir as xfs maintainer for 5.10.y 2022-07-02 16:39:22 +02:00
Makefile Linux 5.10.155 2022-11-16 09:57:20 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.