The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=06fd19b5349a1ff27ef338619fdade596986fc2f

commit 06fd19b5349a1ff27ef338619fdade596986fc2f
Author:     John Baldwin <[email protected]>
AuthorDate: 2026-02-06 15:30:26 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2026-02-06 15:30:26 +0000

    spibus: Don't leak KVA when freeing a mmap region
    
    Effort:         CHERI upstreaming
    Sponsored by:   AFRL, DARPA
    Differential Revision:  https://reviews.freebsd.org/D54837
---
 sys/dev/spibus/spigen.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/spibus/spigen.c b/sys/dev/spibus/spigen.c
index 66c93e927281..39b94c6123fc 100644
--- a/sys/dev/spibus/spigen.c
+++ b/sys/dev/spibus/spigen.c
@@ -283,8 +283,10 @@ spigen_mmap_cleanup(void *arg)
 {
        struct spigen_mmap *mmap = arg;
 
-       if (mmap->kvaddr != 0)
+       if (mmap->kvaddr != 0) {
                pmap_qremove(mmap->kvaddr, mmap->bufsize / PAGE_SIZE);
+               kva_free(mmap->kvaddr, mmap->bufsize);
+       }
        if (mmap->bufobj != NULL)
                vm_object_deallocate(mmap->bufobj);
        free(mmap, M_DEVBUF);

Reply via email to