Skip to content

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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs/zfs#4967
Closes openzfs#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.