Skip to content

Commit aeb9baa

Browse files
GeLiXinbehlendorf
authored andcommitted
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 <ge.lixin@zte.com.cn> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue openzfs#4967 Closes openzfs#567
1 parent 576865b commit aeb9baa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

module/spl/spl-kmem.c

100644100755
+4
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ spl_kmem_free_track(const void *ptr, size_t size)
383383
{
384384
kmem_debug_t *dptr;
385385

386+
/* Ignore NULL pointer since we haven't tracked it at all*/
387+
if (ptr == NULL)
388+
return;
389+
386390
/* Must exist in hash due to kmem_alloc() */
387391
dptr = kmem_del_init(&kmem_lock, kmem_table, KMEM_HASH_BITS, ptr);
388392
ASSERT3P(dptr, !=, NULL);

0 commit comments

Comments
 (0)