git: e49d57eecc8e - stable/13 - linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Oct 2021 00:36:50 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e49d57eecc8e4cb2247fc667928e91f62d392ca0
commit e49d57eecc8e4cb2247fc667928e91f62d392ca0
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-10-06 18:45:22 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-10-13 00:36:18 +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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a76de17715ab689b0b53a1012e22d8a08470b6e4)
---
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 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();