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
This commit is contained in:
kib 2018-02-13 15:44:35 +00:00
parent 0c20f07bdd
commit 068e7ccc44

View File

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