f2fs: prevent creating duplicate encrypted filenames
Eric Biggers authored
commit bfc2b7e8 upstream.

As described in "fscrypt: add fscrypt_is_nokey_name()", it's possible to
create a duplicate filename in an encrypted directory by creating a file
concurrently with adding the directory's encryption key.

Fix this bug on f2fs by rejecting no-key dentries in f2fs_add_link().

Note that the weird check for the current task in f2fs_do_add_link()
seems to make this bug difficult to reproduce on f2fs.

Fixes: 9ea97163 ("f2fs crypto: add filename encryption for f2fs_add_link")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201118075609.120337-4-ebiggers@kernel.org

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
218cf245
Name Last commit Last update
Documentation USB: UAS: introduce a quirk to set no_write_same
LICENSES LICENSES: Remove CC-BY-SA-4.0 license text
arch powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently
block block: factor out requeue handling from dispatch code
certs export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
crypto crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
drivers md/raid10: initialize r10_bio->read_slot before use.
firmware Fix built-in early-load Intel microcode alignment
fs f2fs: prevent creating duplicate encrypted filenames
include fscrypt: add fscrypt_is_nokey_name()
init printk: reduce LOG_BUF_SHIFT range for H8300
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
kernel genirq/irqdomain: Don't try to free an interrupt that has no mapping
lib random32: make prandom_u32() output unpredictable
mm mm/swapfile: do not sleep with a spin lock held
net lwt: Disable BH too in run_lwt_bpf()
samples samples: bpf: Fix lwt_len_hist reusing previous BPF map
scripts kconfig: fix return value of do_error_if()
security ima: Don't modify file descriptor mode on the fly
sound ALSA: usb-audio: Disable sample read check if firmware doesn't give back
tools perf record: Fix memory leak when using '--user-regs=?' to list registers
usr initramfs: restore default compression behavior
virt KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace
.clang-format clang-format: Set IndentWrappedFunctionNames false
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
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.
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.