No description
Find a file
Eric Biggers 08adf452e6 ext4: fix race between ext4_sync_parent() and rename()
'igrab(d_inode(dentry->d_parent))' without holding dentry->d_lock is
broken because without d_lock, d_parent can be concurrently changed due
to a rename().  Then if the old directory is immediately deleted, old
d_parent->inode can be NULL.  That causes a NULL dereference in igrab().

To fix this, use dget_parent() to safely grab a reference to the parent
dentry, which pins the inode.  This also eliminates the need to use
d_find_any_alias() other than for the initial inode, as we no longer
throw away the dentry at each step.

This is an extremely hard race to hit, but it is possible.  Adding a
udelay() in between the reads of ->d_parent and its ->d_inode makes it
reproducible on a no-journal filesystem using the following program:

    #include <fcntl.h>
    #include <unistd.h>

    int main()
    {
        if (fork()) {
            for (;;) {
                mkdir("dir1", 0700);
                int fd = open("dir1/file", O_RDWR|O_CREAT|O_SYNC);
                write(fd, "X", 1);
                close(fd);
            }
        } else {
            mkdir("dir2", 0700);
            for (;;) {
                rename("dir1/file", "dir2/file");
                rmdir("dir1");
            }
        }
    }

Fixes: d59729f4e7 ("ext4: fix races in ext4_sync_parent()")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20200506183140.541194-1-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-06-03 23:16:51 -04:00
arch - Add -fasynchronous-unwind-tables to the vDSO CFLAGS. 2020-05-01 17:09:31 -07:00
block block: remove the bd_openers checks in blk_drop_partitions 2020-04-30 10:25:43 -06:00
certs
crypto
Documentation dmaengine fixes for v5.7-rc4 2020-05-02 11:16:14 -07:00
drivers IOMMU Fixes for Linux v5.7-rc3 2020-05-03 11:04:57 -07:00
fs ext4: fix race between ext4_sync_parent() and rename() 2020-06-03 23:16:51 -04:00
include writeback: Export inode_io_list_del() 2020-06-03 23:16:49 -04:00
init
ipc
kernel PM: hibernate: Freeze kernel threads in software_resume() 2020-04-27 10:30:30 +02:00
lib linux-kselftest-kunit-5.7-rc4 2020-04-30 16:32:47 -07:00
LICENSES
mm mm: check that mm is still valid in madvise() 2020-04-24 13:28:03 -07:00
net NFS client bugfixes for Linux 5.7 2020-05-02 11:24:01 -07:00
samples vmalloc: fix remap_vmalloc_range() bounds checks 2020-04-21 11:11:56 -07:00
scripts Kbuild fixes for v5.7 2020-04-24 10:39:32 -07:00
security selinux/stable-5.7 PR 20200430 2020-04-30 16:35:45 -07:00
sound sound fixes for 5.7-rc4 2020-05-01 11:05:28 -07:00
tools linux-kselftest-5.7-rc4 2020-04-30 16:28:49 -07:00
usr
virt
.clang-format clang-format: Update with the latest for_each macro list 2020-04-18 13:49:33 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS for-5.7-rc3-tag 2020-05-03 11:30:08 -07:00
Makefile Linux 5.7-rc4 2020-05-03 14:56:04 -07: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.