No description
Find a file
Alexander Potapenko 9eb184b29a mm: fs: initialize fsdata passed to write_begin/write_end interface
commit 1468c6f455 upstream.

Functions implementing the a_ops->write_end() interface accept the `void
*fsdata` parameter that is supposed to be initialized by the corresponding
a_ops->write_begin() (which accepts `void **fsdata`).

However not all a_ops->write_begin() implementations initialize `fsdata`
unconditionally, so it may get passed uninitialized to a_ops->write_end(),
resulting in undefined behavior.

Fix this by initializing fsdata with NULL before the call to
write_begin(), rather than doing so in all possible a_ops implementations.

This patch covers only the following cases found by running x86 KMSAN
under syzkaller:

 - generic_perform_write()
 - cont_expand_zero() and generic_cont_expand_simple()
 - page_symlink()

Other cases of passing uninitialized fsdata may persist in the codebase.

Link: https://lkml.kernel.org/r/20220915150417.722975-43-glider@google.com
Signed-off-by: Alexander Potapenko <glider@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Marco Elver <elver@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-19 17:56:29 +08:00
arch perf/x86/intel/pt: Fix sampling using single range output 2023-04-19 17:56:28 +08:00
block block: sed-opal: kmalloc the cmd/resp buffers 2023-04-19 17:56:20 +08:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2023-04-19 17:50:34 +08:00
crypto crypto: akcipher - default implementation for setting a private key 2023-04-19 17:55:27 +08:00
Documentation docs: update mediator contact information in CoC doc 2023-04-19 17:56:27 +08:00
drivers macvlan: enforce a consistent minimal mtu 2023-04-19 17:56:29 +08:00
fs mm: fs: initialize fsdata passed to write_begin/write_end interface 2023-04-19 17:56:29 +08:00
include wifi: wext: use flex array destination for memcpy() 2023-04-19 17:56:29 +08:00
init stack: Declare {randomize_,}kstack_offset to fix Sparse warnings 2023-04-19 17:52:12 +08:00
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree() 2023-04-19 17:49:52 +08:00
kernel kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case 2023-04-19 17:56:28 +08:00
lib lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 2023-04-19 17:55:38 +08:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
mm mm: fs: initialize fsdata passed to write_begin/write_end interface 2023-04-19 17:56:29 +08:00
net wifi: wext: use flex array destination for memcpy() 2023-04-19 17:56:29 +08:00
samples samples/landlock: Format with clang-format 2023-04-19 17:50:01 +08:00
scripts cert host tools: Stop complaining about deprecated OpenSSL functions 2023-04-19 17:56:14 +08:00
security capabilities: fix potential memleak on error path from vfs_getxattr_alloc() 2023-04-19 17:56:03 +08:00
sound ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book Pro 360 2023-04-19 17:56:25 +08:00
tools selftests/intel_pstate: fix build for ARCH=x86_64 2023-04-19 17:56:17 +08:00
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage 2023-04-19 17:44:58 +08:00
virt kvm: Add support for arch compat vm ioctls 2023-04-19 17:55:40 +08:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap mailmap: add Andrej Shadura 2021-10-18 20:22:03 -10:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: Move Daniel Drake to credits 2021-09-21 08:34:58 +03:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Input: goodix - add a goodix.h header file 2023-04-19 17:50:59 +08:00
Makefile Linux 5.15.79 2023-04-19 17:56:16 +08: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.