summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2017-08-21 21:18:51 +0000
committerjhb <jhb@FreeBSD.org>2017-08-21 21:18:51 +0000
commit161a6f8f9ae58db63659081432df27926e77e116 (patch)
treed8ace4aabdcc639e697dd5fe9416029920f0c9ec
parentf860439490c4efc346d35a16f142e3b6c566178d (diff)
downloadFreeBSD-ports-161a6f8f9ae58db63659081432df27926e77e116.zip
FreeBSD-ports-161a6f8f9ae58db63659081432df27926e77e116.tar.gz
MFH: r448159
Don't leak lock from os_kmem_alloc(). The current port patches for os_kmem_alloc() add VM object locking. However, the lock is not unlocked in the success case because the unlock code is inside of an if body instead of after the if statement. Approved by: ports-secteam (feld)
-rw-r--r--emulators/open-vm-tools/Makefile1
-rw-r--r--emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c20
2 files changed, 11 insertions, 10 deletions
diff --git a/emulators/open-vm-tools/Makefile b/emulators/open-vm-tools/Makefile
index 4531d38..f0675a2 100644
--- a/emulators/open-vm-tools/Makefile
+++ b/emulators/open-vm-tools/Makefile
@@ -4,6 +4,7 @@
PORTNAME= open-vm-tools
PORTVERSION= ${RELEASE_VER}
PORTEPOCH= 2
+PORTREVISION= 1
CATEGORIES= emulators
MAINTAINER= swills@FreeBSD.org
diff --git a/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c b/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c
index 2c404b7..b97fee1 100644
--- a/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c
+++ b/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c
@@ -1,5 +1,5 @@
---- modules/freebsd/vmmemctl/os.c.orig 2017-02-24 22:15:37 UTC
-+++ modules/freebsd/vmmemctl/os.c
+--- modules/freebsd/vmmemctl/os.c.orig 2017-02-24 14:15:37.000000000 -0800
++++ modules/freebsd/vmmemctl/os.c 2017-08-15 13:54:03.813152000 -0700
@@ -37,9 +37,11 @@
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,13 +50,10 @@
- if ( !vm_page_lookup(state->vmobject, page->pindex) ) {
- return;
-- }
+// if ( !vm_page_lookup(state->vmobject, page->pindex) ) {
+// return;
+// }
-
-- os_pmap_putindex(pmap, page->pindex);
-- vm_page_free(page);
++
+// os_pmap_putindex(pmap, page->pindex);
+// vm_page_free(page);
+#if __FreeBSD_version > 1000029
@@ -77,7 +74,10 @@
+#else
+ vm_page_unlock_queues();
+#endif
-+ }
+ }
+-
+- os_pmap_putindex(pmap, page->pindex);
+- vm_page_free(page);
+#if __FreeBSD_version > 1000029
+ VM_OBJECT_WUNLOCK(state->vmobject);
+#else
@@ -106,18 +106,18 @@
return NULL;
}
-@@ -504,6 +550,11 @@ os_kmem_alloc(int alloc_normal_failed) /
-
+@@ -505,6 +551,11 @@ os_kmem_alloc(int alloc_normal_failed) /
if (!page) {
os_pmap_putindex(pmap, pindex);
+ }
+#if __FreeBSD_version > 1000029
+ VM_OBJECT_WUNLOCK(state->vmobject);
+#else
+ VM_OBJECT_UNLOCK(state->vmobject);
+#endif
- }
return page;
+ }
@@ -847,7 +898,7 @@ vmmemctl_sysctl(SYSCTL_HANDLER_ARGS)
static void
vmmemctl_init_sysctl(void)
OpenPOWER on IntegriCloud