Commit 75d14edee5689716b55afe467acfc13206a31f95

Authored by Jason Wessel
1 parent e3bda3ac33

kdb: Fix oops in kdb_unregister

Nothing should try to use kdb_commands directly as sometimes it is
null.  Instead, use the for_each_kdbcmd() iterator.

This particular problem dates back to the initial kdb merge (2.6.35),
but at that point nothing was dynamically unregistering commands from
the kdb shell.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

kernel/debug/kdb/kdb_main.c
... ... @@ -2826,7 +2826,7 @@
2826 2826 /*
2827 2827 * find the command.
2828 2828 */
2829   - for (i = 0, kp = kdb_commands; i < kdb_max_commands; i++, kp++) {
  2829 + for_each_kdbcmd(kp, i) {
2830 2830 if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) {
2831 2831 kp->cmd_name = NULL;
2832 2832 return 0;