git: b339a4a042f9 - stable/15 - spibus: Don't leak KVA when freeing a mmap region
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Apr 2026 17:55:49 UTC
The branch stable/15 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=b339a4a042f97cb5bb334f5551703cc5a475af18
commit b339a4a042f97cb5bb334f5551703cc5a475af18
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-02-06 15:30:26 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-24 15:32:19 +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
(cherry picked from commit 06fd19b5349a1ff27ef338619fdade596986fc2f)
---
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);