aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGeLiXin <[email protected]>2016-08-19 14:50:21 +0800
committerBrian Behlendorf <[email protected]>2016-08-19 09:14:24 -0700
commitaeb9baa618beea1458ab3ab22cbc0f39213da6cf (patch)
treeae81639be26d78b5a4d5651780001a6fbb8adf25 /module
parent576865be20ce4a0d4365cd62a589edec070fe08c (diff)
Fix: handle NULL case in spl_kmem_free_track()
When DEBUG_KMEM_TRACKING is enabled in SPL, we keep tracking all the buffers alloced by kmem_alloc() and kmem_zalloc(). If a NULL pointer which indicates no track info in SPL is passed to spl_kmem_free_track, we just ignore it. Signed-off-by: GeLiXin <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue zfsonlinux/zfs#4967 Closes #567
Diffstat (limited to 'module')
-rwxr-xr-x[-rw-r--r--]module/spl/spl-kmem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index 0931fdfcf..2b68c297a 100644..100755
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -383,6 +383,10 @@ spl_kmem_free_track(const void *ptr, size_t size)
{
kmem_debug_t *dptr;
+ /* Ignore NULL pointer since we haven't tracked it at all*/
+ if (ptr == NULL)
+ return;
+
/* Must exist in hash due to kmem_alloc() */
dptr = kmem_del_init(&kmem_lock, kmem_table, KMEM_HASH_BITS, ptr);
ASSERT3P(dptr, !=, NULL);