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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to