git: a76de17715ab - main - linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Oct 2021 18:50:13 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a76de17715ab689b0b53a1012e22d8a08470b6e4 commit a76de17715ab689b0b53a1012e22d8a08470b6e4 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-10-06 18:45:22 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-10-06 18:49:39 +0000 linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy() This is compatible with Linux, and some driver error paths depend on it. Reviewed by: bz, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32337 --- sys/compat/linuxkpi/common/src/linux_slab.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c index 5dbd87b66d1a..e062f0535fda 100644 --- a/sys/compat/linuxkpi/common/src/linux_slab.c +++ b/sys/compat/linuxkpi/common/src/linux_slab.c @@ -193,6 +193,9 @@ lkpi_kmem_cache_free(struct linux_kmem_cache *c, void *m) void linux_kmem_cache_destroy(struct linux_kmem_cache *c) { + if (c == NULL) + return; + if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) { /* make sure all free callbacks have been called */ rcu_barrier();