From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] scftorture: Handle NULL argument passed to scf_add_to_free_list().
Date: Tue, 12 Nov 2024 17:20:23 +0100 [thread overview]
Message-ID: <20241112162023.glRj_YAz@linutronix.de> (raw)
In-Reply-To: <2375aa2c-3248-4ffa-b9b0-f0a24c50f237@stanley.mountain>
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: 4788c861ad7e9 ("scftorture: Use a lock-less list to free memory.")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Thank you Dan. I had to look twice, that `scfsp' above looked almost
identical.
kernel/scftorture.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index eeafd3fc16820..d86d2d9c46248 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -155,6 +155,8 @@ static void scf_add_to_free_list(struct scf_check *scfcp)
struct llist_head *pool;
unsigned int cpu;
+ if (!scfcp)
+ return;
cpu = raw_smp_processor_id() % nthreads;
pool = &per_cpu(scf_free_pool, cpu);
llist_add(&scfcp->scf_node, pool);
--
2.45.2
next prev parent reply other threads:[~2024-11-12 16:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 10:23 [bug report] scftorture: Use a lock-less list to free memory Dan Carpenter
2024-11-12 16:20 ` Sebastian Andrzej Siewior [this message]
2024-11-12 16:30 ` [PATCH] scftorture: Handle NULL argument passed to scf_add_to_free_list() Dan Carpenter
2024-11-12 19:48 ` Paul E. McKenney
2024-11-13 7:30 ` Dan Carpenter
2024-11-13 14:57 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241112162023.glRj_YAz@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=paulmck@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.