mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
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 <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/2375aa2c-3248-4ffa-b9b0-f0a24c50f237@stanley.mountain
Fixes: 4788c861ad
("scftorture: Use a lock-less list to free memory.")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
4788c861ad
commit
f946cae86d
@ -155,6 +155,8 @@ static void scf_add_to_free_list(struct scf_check *scfcp)
|
|||||||
struct llist_head *pool;
|
struct llist_head *pool;
|
||||||
unsigned int cpu;
|
unsigned int cpu;
|
||||||
|
|
||||||
|
if (!scfcp)
|
||||||
|
return;
|
||||||
cpu = raw_smp_processor_id() % nthreads;
|
cpu = raw_smp_processor_id() % nthreads;
|
||||||
pool = &per_cpu(scf_free_pool, cpu);
|
pool = &per_cpu(scf_free_pool, cpu);
|
||||||
llist_add(&scfcp->scf_node, pool);
|
llist_add(&scfcp->scf_node, pool);
|
||||||
|
Loading…
Reference in New Issue
Block a user