Overlayfs in the Linux kernel and shiftfs, a non-upstream patch to the Linux kernel included in the Ubuntu 5.0 and 5.3 kernel series, both replace vma->vmfile in their mmap handlers. On error the original value is not restored, and the reference is put for the file to which vmfile points. On upstream kernels this is not an issue, as no callers dereference vmfile following after callmmap() returns an error. However, the aufs patchs change mmapregion() to replace the fput() using a local variable with vmafput(), which will fput() vm_file, leading to a refcount underflow.