Linux kernel source tree
Go to file
Sahitya Tummala b9880ec496 FROMLIST: f2fs: fix use-after-free when accessing bio->bi_crypt_context
There could be a potential race between these two paths below,
leading to use-after-free when accessing bio->bi_crypt_context.

f2fs_write_cache_pages
->f2fs_do_write_data_page on page#1
  ->f2fs_inplace_write_data
    ->f2fs_merge_page_bio
      ->add_bio_entry
->f2fs_do_write_data_page on page#2
  ->f2fs_inplace_write_data
    ->f2fs_merge_page_bio
      ->f2fs_crypt_mergeable_bio
        ->fscrypt_mergeable_bio
                                       f2fs_write_begin on page#1
                                       ->f2fs_wait_on_page_writeback
                                         ->f2fs_submit_merged_ipu_write
                                           ->__submit_bio
                                        The bio gets completed, calling
                                        bio_endio
                                        ->bio_uninit
                                          ->bio_crypt_free_ctx
          ->use-after-free issue

Fix this by moving f2fs_crypt_mergeable_bio() check within
add_ipu_page() so that it's done under bio_list_lock to prevent
the above race.

Bug: 137270441
Link: https://lore.kernel.org/linux-f2fs-devel/1592193588-21701-1-git-send-email-stummala@codeaurora.org/
Fixes: fb710731b6 ("f2fs: add inline encryption support")
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Satya Tangirala <satyat@google.com>
Change-Id: I1bd2cfa430423ba2a8d7c1da505322ded097cd9e
2020-06-22 19:32:10 +00:00
arch ANDROID: GKI: Update whitelist and defconfig for incfs 2020-06-22 15:08:12 +00:00
block ANDROID: block: backport the ability to specify max_dun_bytes 2020-05-14 15:44:27 -07:00
certs export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR() 2018-08-22 23:21:44 +09:00
crypto This is the 4.19.124 stable release 2020-05-20 11:37:46 +02:00
Documentation Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19-stable 2020-06-22 09:42:24 -07:00
drivers UPSTREAM: fdt: Update CRC check for rng-seed 2020-06-22 15:53:15 +00:00
firmware Fix built-in early-load Intel microcode alignment 2020-01-23 08:21:29 +01:00
fs FROMLIST: f2fs: fix use-after-free when accessing bio->bi_crypt_context 2020-06-22 19:32:10 +00:00
include Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19-stable 2020-06-22 09:42:24 -07:00
init This is the 4.19.124 stable release 2020-05-20 11:37:46 +02:00
ipc This is the 4.19.124 stable release 2020-05-20 11:37:46 +02:00
kernel This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
lib This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
LICENSES LICENSES: Remove CC-BY-SA-4.0 license text 2018-10-18 11:28:50 +02:00
mm This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
net This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
samples This is the 4.19.126 stable release 2020-06-03 09:23:15 +02:00
scripts ANDROID: kbuild: merge more sections with LTO 2020-06-15 15:49:45 +00:00
security This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
sound This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
tools This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
usr initramfs: restore default compression behavior 2020-04-13 10:44:59 +02:00
virt KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception 2020-06-22 09:05:09 +02:00
.clang-format clang-format: Set IndentWrappedFunctionNames false 2018-08-01 18:38:51 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files 2016-10-07 18:46:30 -07:00
.gitignore Kbuild updates for v4.17 (2nd) 2018-04-15 17:21:30 -07:00
.mailmap libnvdimm-for-4.19_misc 2018-08-25 18:13:10 -07:00
abi_gki_aarch64_cuttlefish_whitelist ANDROID: abi_gki_aarch64_cuttlefish_whitelist: remove stale symbols 2020-04-29 10:52:02 +00:00
abi_gki_aarch64_qcom_whitelist ANDROID: GKI: Update whitelist and defconfig for incfs 2020-06-22 15:08:12 +00:00
abi_gki_aarch64_whitelist ANDROID: GKI: Update the ABI xml and whitelist 2020-05-14 15:58:13 -07:00
abi_gki_aarch64.xml ANDROID: GKI: Update ABI for incremental fs 2020-06-22 15:08:24 +00:00
build.config.aarch64 ANDROID: add compat cross compiler 2020-04-27 22:52:19 -07:00
build.config.allmodconfig ANDROID: build.config.allmodconfig: Re-enable XFS_FS 2020-04-17 08:41:31 +00:00
build.config.allmodconfig.aarch64 ANDROID: Add allmodconfig build.configs for x86_64 and aarch64 2019-11-12 20:55:23 +00:00
build.config.allmodconfig.arm ANDROID: Add build.config files for ARM 32-bit 2020-03-16 17:43:55 +00:00
build.config.allmodconfig.x86_64 ANDROID: Add allmodconfig build.configs for x86_64 and aarch64 2019-11-12 20:55:23 +00:00
build.config.arm ANDROID: Add build.config files for ARM 32-bit 2020-03-16 17:43:55 +00:00
build.config.common ANDROID: Use depmod from the hermetic toolchain 2020-06-22 12:55:38 +00:00
build.config.gki ANDROID: gki: Removed cf modules from gki_defconfig 2020-01-31 16:23:38 -08:00
build.config.gki_kasan ANDROID: Rename build.config.gki.arch_kasan 2020-05-05 20:46:14 +00:00
build.config.gki_kasan.aarch64 ANDROID: Drop ABI monitoring from KASAN build config 2020-05-06 11:13:09 +00:00
build.config.gki_kasan.x86_64 ANDROID: Rename build.config.gki.arch_kasan 2020-05-05 20:46:14 +00:00
build.config.gki-debug.aarch64 ANDROID: Fix build.config.gki-debug 2020-05-20 11:50:18 +00:00
build.config.gki-debug.x86_64 ANDROID: Fix build.config.gki-debug 2020-05-20 11:50:18 +00:00
build.config.gki.aarch64 ANDROID: build.config.gki.aarch64: Enable WHITELIST_STRICT_MODE 2020-05-07 08:12:23 +00:00
build.config.gki.x86_64 ANDROID: refactor build.config files to remove duplication 2019-10-22 18:27:12 -07:00
build.config.x86_64 ANDROID: refactor build.config files to remove duplication 2019-10-22 18:27:12 -07:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS 9p: remove Ron Minnich from MAINTAINERS 2018-08-17 16:20:26 -07:00
Kbuild Kbuild updates for v4.15 2017-11-17 17:45:29 -08:00
Kconfig kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt 2018-08-02 08:06:55 +09:00
MAINTAINERS This is the 4.19.107 stable release 2020-03-03 07:33:01 +01:00
Makefile This is the 4.19.129 stable release 2020-06-22 10:50:54 +02:00
README Docs: Added a pointer to the formatted docs to README 2018-03-21 09:02:53 -06:00

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.
See Documentation/00-INDEX for a list of what is contained in each file.

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.