Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jun 2017 14:38:52 +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: r320189 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201706211438.v5LEcqFZ070525@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Jun 21 14:38:52 2017
New Revision: 320189
URL: https://svnweb.freebsd.org/changeset/base/320189

Log:
  Allow the VM fault handler to be NULL in the LinuxKPI when handling a
  memory map request. When the VM fault handler is NULL a return code of
  VM_PAGER_BAD is returned from the character device's pager populate
  handler. This fixes compatibility with Linux.
  
  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 Jun 21 14:36:25 2017	(r320188)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c	Wed Jun 21 14:38:52 2017	(r320189)
@@ -497,7 +497,7 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pinde
 	VM_OBJECT_WUNLOCK(vm_obj);
 
 	down_write(&vmap->vm_mm->mmap_sem);
-	if (unlikely(vmap->vm_ops == NULL)) {
+	if (unlikely(vmap->vm_ops == NULL || vmap->vm_ops->fault == NULL)) {
 		err = VM_FAULT_SIGBUS;
 	} else {
 		vmap->vm_pfn_count = 0;
@@ -1173,8 +1173,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *
 	if (vmap->vm_ops != NULL) {
 		void *vm_private_data;
 
-		if (vmap->vm_ops->fault == NULL ||
-		    vmap->vm_ops->open == NULL ||
+		if (vmap->vm_ops->open == NULL ||
 		    vmap->vm_ops->close == NULL ||
 		    vmap->vm_private_data == NULL) {
 			linux_cdev_handle_free(vmap);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706211438.v5LEcqFZ070525>