diff options
author | Douglas Anderson <dianders@chromium.org> | 2018-12-04 19:38:28 -0800 |
---|---|---|
committer | Daniel Thompson <daniel.thompson@linaro.org> | 2018-12-30 08:31:23 +0000 |
commit | 162bc7f5afd75b72acbe3c5f3488ef7e64a3fe36 (patch) | |
tree | 28a6c66c667177ad20271d85d332f0e3831b955f /kernel/debug/kdb/kdb_bt.c | |
parent | 87b095928584da7d5cb3149016f00b0b139c2292 (diff) | |
download | lwn-162bc7f5afd75b72acbe3c5f3488ef7e64a3fe36.tar.gz lwn-162bc7f5afd75b72acbe3c5f3488ef7e64a3fe36.zip |
kdb: Don't back trace on a cpu that didn't round up
If you have a CPU that fails to round up and then run 'btc' you'll end
up crashing in kdb becaue we dereferenced NULL. Let's add a check.
It's wise to also set the task to NULL when leaving the debugger so
that if we fail to round up on a later entry into the debugger we
won't backtrace a stale task.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Diffstat (limited to 'kernel/debug/kdb/kdb_bt.c')
-rw-r--r-- | kernel/debug/kdb/kdb_bt.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c index 7921ae4fca8d..7e2379aa0a1e 100644 --- a/kernel/debug/kdb/kdb_bt.c +++ b/kernel/debug/kdb/kdb_bt.c @@ -186,7 +186,16 @@ kdb_bt(int argc, const char **argv) kdb_printf("btc: cpu status: "); kdb_parse("cpu\n"); for_each_online_cpu(cpu) { - sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); + void *kdb_tsk = KDB_TSK(cpu); + + /* If a CPU failed to round up we could be here */ + if (!kdb_tsk) { + kdb_printf("WARNING: no task for cpu %ld\n", + cpu); + continue; + } + + sprintf(buf, "btt 0x%px\n", kdb_tsk); kdb_parse(buf); touch_nmi_watchdog(); } |