diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-10-06 18:45:22 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-10-13 00:36:18 +0000 |
commit | e49d57eecc8e4cb2247fc667928e91f62d392ca0 (patch) | |
tree | 4f1f217141af029d7e48ee921ddaead8bf7d14b7 | |
parent | 16dfe02e38b957206ddda0cffd7e938b01fa1302 (diff) | |
download | src-e49d57eecc8e4cb2247fc667928e91f62d392ca0.tar.gz src-e49d57eecc8e4cb2247fc667928e91f62d392ca0.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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a76de17715ab689b0b53a1012e22d8a08470b6e4)
-rw-r--r-- | sys/compat/linuxkpi/common/src/linux_slab.c | 3 |
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 35a88fd7cf42..0aa751ec886e 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(); |