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);
 }
 
_______________________________________________
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