Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Fix: handle NULL case in spl_kmem_free_track()
Browse files Browse the repository at this point in the history
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 <ge.lixin@zte.com.cn>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs/zfs#4967
Closes #567
  • Loading branch information
GeLiXin authored and behlendorf committed Aug 19, 2016
1 parent 576865b commit aeb9baa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions module/spl/spl-kmem.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit aeb9baa

Please sign in to comment.