No description
Find a file
Takashi Iwai e7e0ca2007 ALSA: core: Fix NULL module pointer assignment at card init
commit 39381fe739 upstream.

The commit 81033c6b58 ("ALSA: core: Warn on empty module")
introduced a WARN_ON() for a NULL module pointer passed at snd_card
object creation, and it also wraps the code around it with '#ifdef
MODULE'.  This works in most cases, but the devils are always in
details.  "MODULE" is defined when the target code (i.e. the sound
core) is built as a module; but this doesn't mean that the caller is
also built-in or not.  Namely, when only the sound core is built-in
(CONFIG_SND=y) while the driver is a module (CONFIG_SND_USB_AUDIO=m),
the passed module pointer is ignored even if it's non-NULL, and
card->module remains as NULL.  This would result in the missing module
reference up/down at the device open/close, leading to a race with the
code execution after the module removal.

For addressing the bug, move the assignment of card->module again out
of ifdef.  The WARN_ON() is still wrapped with ifdef because the
module can be really NULL when all sound drivers are built-in.

Note that we keep 'ifdef MODULE' for WARN_ON(), otherwise it would
lead to a false-positive NULL module check.  Admittedly it won't catch
perfectly, i.e. no check is performed when CONFIG_SND=y.  But, it's no
real problem as it's only for debugging, and the condition is pretty
rare.

Fixes: 81033c6b58 ("ALSA: core: Warn on empty module")
Reported-by: Xu Yang <xu.yang_2@nxp.com>
Closes: https://lore.kernel.org/r/20240520170349.2417900-1-xu.yang_2@nxp.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20240522070442.17786-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:39:13 +02:00
arch x86/tsc: Trust initial offset in architectural TSC-adjust MSRs 2024-06-16 13:39:11 +02:00
block blk-iocost: avoid out of bounds shift 2024-05-17 11:50:54 +02:00
certs
crypto Revert "crypto: api - Disallow identical driver names" 2024-05-02 16:24:47 +02:00
Documentation docs: kernel_include.py: Cope with docutils 0.21 2024-05-25 16:20:19 +02:00
drivers net: smc91x: Fix m68k kernel compilation for ColdFire CPU 2024-06-16 13:39:12 +02:00
fs fs/ntfs3: Break dir enumeration if directory contents error 2024-06-16 13:39:13 +02:00
include tls: fix race between async notify and socket close 2024-05-25 16:20:17 +02:00
init init/main.c: Fix potential static_command_line memory overflow 2024-04-27 17:05:28 +02:00
io_uring io_uring: ensure '0' is returned on file registration success 2024-04-10 16:19:37 +02:00
ipc ipc/sem: Fix dangling sem_array access in semtimedop race 2022-12-08 11:28:45 +01:00
kernel ring-buffer: Fix a race between readers and resize checks 2024-06-16 13:39:12 +02:00
lib dyndbg: fix old BUG_ON in >control parser 2024-05-17 11:51:04 +02:00
LICENSES
mm x86/mm/pat: fix VM_PAT handling in COW mappings 2024-04-13 13:01:47 +02:00
net netlink: annotate data-races around sk->sk_err 2024-05-25 16:20:17 +02:00
samples samples/hw_breakpoint: fix building without module unloading 2023-09-23 11:10:01 +02:00
scripts kbuild: Disable KCSAN for autogenerated *.mod.c intermediaries 2024-05-17 11:50:53 +02:00
security KEYS: trusted: Do not use WARN when encode fails 2024-05-25 16:20:18 +02:00
sound ALSA: core: Fix NULL module pointer assignment at card init 2024-06-16 13:39:13 +02:00
tools tools/latency-collector: Fix -Wformat-security compile warns 2024-06-16 13:39:12 +02:00
usr
virt KVM: Always flush async #PF workqueue when vCPU is being destroyed 2024-04-10 16:18:34 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS trace: Relocate event helper files 2024-04-10 16:19:24 +02:00
Makefile Linux 5.15.160 2024-05-25 16:20:19 +02: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.