]> git.proxmox.com Git - mirror_ubuntu-impish-kernel.git/commit
UBUNTU: SAUCE: shiftfs: Restore vm_file value when lower fs mmap fails
authorSeth Forshee <seth.forshee@canonical.com>
Wed, 6 Nov 2019 15:38:57 +0000 (09:38 -0600)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 28 Jun 2021 06:03:49 +0000 (08:03 +0200)
commita06d79532dd19168b17f742ede96202632af704d
treedb1ade7eadd93262ef07d68a4d9b67b32cd30e0b
parent1443bc4a25ca84d60d39a8ae1dc6215abdd637a4
UBUNTU: SAUCE: shiftfs: Restore vm_file value when lower fs mmap fails

BugLink: https://bugs.launchpad.net/bugs/1850994
shiftfs_mmap() overwrites vma->vm_file before calling the lower
filesystem mmap but does not restore the original value on
failure. This means it is giving a pointer to the lower fs file
back to the caller with no reference, which is a bad practice.
However, it does not lead to any issues with upstream kernels as
no caller accesses vma->vm_file after call_mmap().

With the aufs patches applied the story is different. Whereas
mmap_region() previously fput a local variable containing the
file it assigned to vm_file, it now calls vma_fput() which will
fput vm_file, for which it has no reference, and the reference
for the original vm_file is not put.

Fix this by restoring vma->vm_file to the original value when the
mmap call into the lower fs fails.

CVE-2019-15794

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/shiftfs.c