Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2017 17:47:59 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r448159 - in head/emulators/open-vm-tools: . files
Message-ID:  <201708171747.v7HHlxO9052372@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb (src,doc committer)
Date: Thu Aug 17 17:47:58 2017
New Revision: 448159
URL: https://svnweb.freebsd.org/changeset/ports/448159

Log:
  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.
  
  Reported by:	jpaetzel
  Reviewed by:	jpaetzel
  Approved by:	swills
  MFH:		2017Q3
  Differential Revision:	https://reviews.freebsd.org/D12038

Modified:
  head/emulators/open-vm-tools/Makefile
  head/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c

Modified: head/emulators/open-vm-tools/Makefile
==============================================================================
--- head/emulators/open-vm-tools/Makefile	Thu Aug 17 17:46:28 2017	(r448158)
+++ head/emulators/open-vm-tools/Makefile	Thu Aug 17 17:47:58 2017	(r448159)
@@ -5,6 +5,7 @@ PORTNAME=		open-vm-tools
 PORTVERSION=		${RELEASE_VER}
 DISTVERSIONPREFIX=	stable-
 PORTEPOCH=		2
+PORTREVISION=		1
 CATEGORIES=		emulators
 
 MAINTAINER=		swills@FreeBSD.org

Modified: head/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c
==============================================================================
--- head/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c	Thu Aug 17 17:46:28 2017	(r448158)
+++ head/emulators/open-vm-tools/files/patch-modules_freebsd_vmmemctl_os.c	Thu Aug 17 17:47:58 2017	(r448159)
@@ -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)



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