aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-10-06 18:45:22 +0000
committerMark Johnston <markj@FreeBSD.org>2021-10-06 18:49:39 +0000
commita76de17715ab689b0b53a1012e22d8a08470b6e4 (patch)
tree0b859920a71c848a7a01f799cd6d60c3c9c662dd
parentda3278ded3b2647d26da26788bab8363e502a144 (diff)
downloadsrc-a76de17715ab689b0b53a1012e22d8a08470b6e4.tar.gz
src-a76de17715ab689b0b53a1012e22d8a08470b6e4.zip
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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_slab.c3
1 files changed, 3 insertions, 0 deletions
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();