Date: Wed, 31 May 2017 13:07:05 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319320 - head/sys/compat/linuxkpi/common/src Message-ID: <201705311307.v4VD75jr032207@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed May 31 13:07:05 2017 New Revision: 319320 URL: https://svnweb.freebsd.org/changeset/base/319320 Log: Make sure the VMAP's "vm_file" field is referenced in a Linux compatible way by the linux_dev_mmap_single() function in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 31 13:05:54 2017 (r319319) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 31 13:07:05 2017 (r319320) @@ -489,6 +489,10 @@ static TAILQ_HEAD(, vm_area_struct) linux_vma_head = static void linux_cdev_handle_free(struct vm_area_struct *vmap) { + /* Drop reference on vm_file */ + if (vmap->vm_file != NULL) + fput(vmap->vm_file); + /* Drop reference on mm_struct */ mmput(vmap->vm_mm); @@ -931,7 +935,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * vmap->vm_pfn = 0; vmap->vm_flags = vmap->vm_page_prot = nprot; vmap->vm_ops = NULL; - vmap->vm_file = filp; + vmap->vm_file = get_file(filp); vmap->vm_mm = mm; if (unlikely(down_write_killable(&vmap->vm_mm->mmap_sem))) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705311307.v4VD75jr032207>