From owner-svn-src-head@freebsd.org Wed Jun 21 14:38:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAC3CD91029; Wed, 21 Jun 2017 14:38:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ABD56F236; Wed, 21 Jun 2017 14:38:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5LEcqbG070526; Wed, 21 Jun 2017 14:38:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5LEcqFZ070525; Wed, 21 Jun 2017 14:38:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201706211438.v5LEcqFZ070525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 21 Jun 2017 14:38:52 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jun 2017 14:38:53 -0000 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);