On Tue, Jul 23, 2019 at 04:17:01PM -0400, Jan Harkes wrote:
commit 7fa0a1da3dadfd9216df7745a1331fdaa0940d1c upstream.
Various file systems expect that vma->vm_file points at their own file handle, several use file_inode(vma->vm_file) to get at their inode or use vma->vm_file->private_data. However the way Coda wrapped mmap on a host file broke this assumption, vm_file was still pointing at the Coda file and the host file systems would scribble over Coda's inode and private file data.
This patch fixes the incorrect expectation and wraps vm_ops->open and vm_ops->close to allow Coda to track when the vm_area_struct is destroyed so we still release the reference on the Coda file handle at the right time.
This patch differs from the original upstream patch because older stable kernels do not have the call_mmap vfs helper so we call f_ops->mmap directly.
Cc: stable@vger.kernel.org # 4.9.x Cc: stable@vger.kernel.org # 4.4.x
Now queued up, thanks!
greg k-h