]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Do not leak rv->psind in some specific situations.
authorKonstantin Belousov <kib@FreeBSD.org>
Tue, 13 Feb 2018 15:36:28 +0000 (15:36 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 13 Feb 2018 15:36:28 +0000 (15:36 +0000)
commitc4be9169c063c09509250e279bc791fd802b111f
tree3932931cd42991ef8915716844e912300fbdaf81
parentc688c9051b3d31f3cd44d7eddc02d7a189888936
Do not leak rv->psind in some specific situations.

Suppose that we have an object with a mapped superpage, and that all
pages in the superpages are held (by some driver).  Additionally,
suppose that the object is terminated, e.g. because the only process
mapping it is exiting.  Then the reservation is broken, but the pages
cannot be freed until later, when they are unheld.  In this situation,
the reservation code cannot clean psind, since no pages are freed, and
the page is freed and then reused with invalid psind.

Clean psind on vm_reserv_break() to avoid the situation.

Reported and tested by: Slava Shwartsman
Reviewed by: markj
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D14335
sys/vm/vm_reserv.c