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))) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"