svn commit: r329216 - head/sys/compat/linuxkpi/common/include/linux

Konstantin Belousov kib at FreeBSD.org
Tue Feb 13 15:44:36 UTC 2018


Author: kib
Date: Tue Feb 13 15:44:35 2018
New Revision: 329216
URL: https://svnweb.freebsd.org/changeset/base/329216

Log:
  linuxkpi: Do not leak pages on put.
  
  When the owner of the wire reference releases the last reference, it
  might be that the page was already attempted to be freed (but free
  cannot be performed at that time due to wire).  Check that the page
  was removed from the object as the indicator of the free attempt and
  finish the free operation if so.
  
  Reported and tested by:	Slava Shwartsman
  Reviewed by:	hselasky
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/mm.h

Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/mm.h	Tue Feb 13 15:36:28 2018	(r329215)
+++ head/sys/compat/linuxkpi/common/include/linux/mm.h	Tue Feb 13 15:44:35 2018	(r329216)
@@ -243,7 +243,8 @@ static inline void
 put_page(struct vm_page *page)
 {
 	vm_page_lock(page);
-	vm_page_unwire(page, PQ_ACTIVE);
+	if (vm_page_unwire(page, PQ_ACTIVE) && page->object == NULL)
+		vm_page_free(page);
 	vm_page_unlock(page);
 }
 


More information about the svn-src-head mailing list