git: 87599597b02e - stable/15 - swapoff: don't leak vnode pointer to device

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 20 Nov 2026 09:30:28 UTC
The branch stable/15 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=87599597b02e7b0d83895dbe3902cce0b60f47ff

commit 87599597b02e7b0d83895dbe3902cce0b60f47ff
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-13 10:06:53 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-19 21:12:39 +0000

    swapoff: don't leak vnode pointer to device
    
    After looking up the device path, we compare the vnode to the vnode of
    each swap device.  Prior to this change we leaked a vnode reference to
    the device we're trying to remove from the swap pool.
    
    Effort:         CHERI upstreaming
    Reviewed by:    kib, markj
    Reported by:    llm-postcr
    MFC after:      3 days
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D61464
    
    (cherry picked from commit 9506d8e0b1788068cbd4c2cbc984cb6ee0dcb0ab)
---
 sys/vm/swap_pager.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 2cc61149e6d2..2b5fc64de771 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2815,6 +2815,7 @@ kern_swapoff(struct thread *td, const char *name, enum uio_seg name_seg,
 			break;
 	}
 	mtx_unlock(&sw_dev_mtx);
+	vrele(vp);
 	if (sp == NULL) {
 		error = EINVAL;
 		goto done;