Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2017 14:29:21 +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: r317504 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201704271429.v3RETL2x001754@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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