svn commit: r317504 - head/sys/compat/linuxkpi/common/src

Hans Petter Selasky hselasky at FreeBSD.org
Thu Apr 27 14:29:22 UTC 2017


Author: hselasky
Date: Thu Apr 27 14:29:21 2017
New Revision: 317504
URL: https://svnweb.freebsd.org/changeset/base/317504

Log:
  Prefer to use real virtual address over direct map address in the
  linux_page_address() function in the LinuxKPI. This solves an issue
  where the return value from linux_page_address() is passed to
  kmem_free().
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_page.c

Modified: head/sys/compat/linuxkpi/common/src/linux_page.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_page.c	Thu Apr 27 12:59:14 2017	(r317503)
+++ head/sys/compat/linuxkpi/common/src/linux_page.c	Thu Apr 27 14:29:21 2017	(r317504)
@@ -71,14 +71,16 @@ __FBSDID("$FreeBSD$");
 void *
 linux_page_address(struct page *page)
 {
+
+	if (page->object != kmem_object && page->object != kernel_object) {
 #ifdef LINUXKPI_HAVE_DMAP
-	return ((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page)));
+		return ((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page)));
 #else
-	if (page->object != kmem_object && page->object != kernel_object)
 		return (NULL);
+#endif
+	}
 	return ((void *)(uintptr_t)(VM_MIN_KERNEL_ADDRESS +
 	    IDX_TO_OFF(page->pindex)));
-#endif
 }
 
 vm_page_t


More information about the svn-src-head mailing list