Skip to content

Commit f946cae

Browse files
Sebastian Andrzej Siewiorpaulmckrcu
Sebastian Andrzej Siewior
authored andcommitted
scftorture: Handle NULL argument passed to scf_add_to_free_list().
Dan reported that after the rework the newly introduced scf_add_to_free_list() may get a NULL pointer passed. This replaced kfree() which was fine with a NULL pointer but scf_add_to_free_list() isn't. Let scf_add_to_free_list() handle NULL pointer. Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/all/[email protected] Fixes: 4788c86 ("scftorture: Use a lock-less list to free memory.") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 4788c86 commit f946cae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/scftorture.c

+2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ static void scf_add_to_free_list(struct scf_check *scfcp)
155155
struct llist_head *pool;
156156
unsigned int cpu;
157157

158+
if (!scfcp)
159+
return;
158160
cpu = raw_smp_processor_id() % nthreads;
159161
pool = &per_cpu(scf_free_pool, cpu);
160162
llist_add(&scfcp->scf_node, pool);

0 commit comments

Comments
 (0)